@@ -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
0 commit comments