File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
Expand file tree Collapse file tree 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");
1313import utils = require( "./utils" ) ;
1414
1515export class PowerShellProcess {
16+ public static escapeSingleQuotes ( pspath : string ) : string {
17+ return pspath . replace ( new RegExp ( "'" , "g" ) , "''" ) ;
18+ }
1619
1720 public onExited : vscode . Event < void > ;
1821 private onExitedEmitter = new vscode . EventEmitter < void > ( ) ;
@@ -52,8 +55,8 @@ export class PowerShellProcess {
5255 : "" ;
5356
5457 this . startArgs +=
55- `-LogPath '${ editorServicesLogPath } ' ` +
56- `-SessionDetailsPath '${ this . sessionFilePath } ' ` +
58+ `-LogPath '${ PowerShellProcess . escapeSingleQuotes ( editorServicesLogPath ) } ' ` +
59+ `-SessionDetailsPath '${ PowerShellProcess . escapeSingleQuotes ( this . sessionFilePath ) } ' ` +
5760 `-FeatureFlags @(${ featureFlags } )` ;
5861
5962 const powerShellArgs = [
@@ -68,7 +71,7 @@ export class PowerShellProcess {
6871
6972 powerShellArgs . push (
7073 "-Command" ,
71- "& '" + startScriptPath + "' " + this . startArgs ) ;
74+ "& '" + PowerShellProcess . escapeSingleQuotes ( startScriptPath ) + "' " + this . startArgs ) ;
7275
7376 let powerShellExePath = this . exePath ;
7477
Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ export class SessionManager implements Middleware {
173173 `-HostProfileId 'Microsoft.VSCode' ` +
174174 `-HostVersion '${ this . hostVersion } '` +
175175 `-AdditionalModules @('PowerShellEditorServices.VSCode') ` +
176- `-BundledModulesPath '${ this . bundledModulesPath } '` +
176+ `-BundledModulesPath '${ PowerShellProcess . escapeSingleQuotes ( this . bundledModulesPath ) } '` +
177177 `-EnableConsoleRepl ` +
178178 `-LanguageServicePipeName LanguageService_${ id } .pipe ` +
179179 `-DebugServicePipeName DebugService_${ id } .pipe ` ;
You can’t perform that action at this time.
0 commit comments