From d699dacce6afd2bd4ba1cdff6b5d634c2379e241 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Tue, 2 Apr 2019 09:19:43 -0700 Subject: [PATCH] Not -EncodedCommand on Windows --- src/process.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/process.ts b/src/process.ts index 95530dbadb..ec1b73b1b0 100644 --- a/src/process.ts +++ b/src/process.ts @@ -69,14 +69,20 @@ export class PowerShellProcess { powerShellArgs.push("-ExecutionPolicy", "Bypass"); } - const stringToEncode = "& '" + + const startEditorServices = "& '" + PowerShellProcess.escapeSingleQuotes(startScriptPath) + "' " + this.startArgs; - // Use -EncodedCommand because the command is complex and has quotes in it that need to work xplat. - powerShellArgs.push( - "-EncodedCommand", - Buffer.from(stringToEncode, "utf16le").toString("base64")); + if (utils.isWindowsOS()) { + powerShellArgs.push( + "-Command", + startEditorServices); + } else { + // Use -EncodedCommand for better quote support on non-Windows + powerShellArgs.push( + "-EncodedCommand", + Buffer.from(startEditorServices, "utf16le").toString("base64")); + } let powerShellExePath = this.exePath;