File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ import Settings = require("./settings");
13
13
import utils = require( "./utils" ) ;
14
14
15
15
export class PowerShellProcess {
16
+ public static escapeSingleQuotes ( pspath : string ) : string {
17
+ return pspath . replace ( new RegExp ( "'" , "g" ) , "''" ) ;
18
+ }
16
19
17
20
public onExited : vscode . Event < void > ;
18
21
private onExitedEmitter = new vscode . EventEmitter < void > ( ) ;
@@ -52,8 +55,8 @@ export class PowerShellProcess {
52
55
: "" ;
53
56
54
57
this . startArgs +=
55
- `-LogPath '${ editorServicesLogPath } ' ` +
56
- `-SessionDetailsPath '${ this . sessionFilePath } ' ` +
58
+ `-LogPath '${ PowerShellProcess . escapeSingleQuotes ( editorServicesLogPath ) } ' ` +
59
+ `-SessionDetailsPath '${ PowerShellProcess . escapeSingleQuotes ( this . sessionFilePath ) } ' ` +
57
60
`-FeatureFlags @(${ featureFlags } )` ;
58
61
59
62
const powerShellArgs = [
@@ -68,7 +71,7 @@ export class PowerShellProcess {
68
71
69
72
powerShellArgs . push (
70
73
"-Command" ,
71
- "& '" + startScriptPath + "' " + this . startArgs ) ;
74
+ "& '" + PowerShellProcess . escapeSingleQuotes ( startScriptPath ) + "' " + this . startArgs ) ;
72
75
73
76
let powerShellExePath = this . exePath ;
74
77
Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ export class SessionManager implements Middleware {
173
173
`-HostProfileId 'Microsoft.VSCode' ` +
174
174
`-HostVersion '${ this . hostVersion } '` +
175
175
`-AdditionalModules @('PowerShellEditorServices.VSCode') ` +
176
- `-BundledModulesPath '${ this . bundledModulesPath } '` +
176
+ `-BundledModulesPath '${ PowerShellProcess . escapeSingleQuotes ( this . bundledModulesPath ) } '` +
177
177
`-EnableConsoleRepl ` +
178
178
`-LanguageServicePipeName LanguageService_${ id } .pipe ` +
179
179
`-DebugServicePipeName DebugService_${ id } .pipe ` ;
You can’t perform that action at this time.
0 commit comments