Skip to content

Commit f9e13c6

Browse files
Not -EncodedCommand on Windows (#1837)
1 parent 25e2da5 commit f9e13c6

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/process.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,20 @@ export class PowerShellProcess {
6969
powerShellArgs.push("-ExecutionPolicy", "Bypass");
7070
}
7171

72-
const stringToEncode = "& '" +
72+
const startEditorServices = "& '" +
7373
PowerShellProcess.escapeSingleQuotes(startScriptPath) +
7474
"' " + this.startArgs;
7575

76-
// Use -EncodedCommand because the command is complex and has quotes in it that need to work xplat.
77-
powerShellArgs.push(
78-
"-EncodedCommand",
79-
Buffer.from(stringToEncode, "utf16le").toString("base64"));
76+
if (utils.isWindowsOS()) {
77+
powerShellArgs.push(
78+
"-Command",
79+
startEditorServices);
80+
} else {
81+
// Use -EncodedCommand for better quote support on non-Windows
82+
powerShellArgs.push(
83+
"-EncodedCommand",
84+
Buffer.from(startEditorServices, "utf16le").toString("base64"));
85+
}
8086

8187
let powerShellExePath = this.exePath;
8288

0 commit comments

Comments
 (0)