From 621c989c6d3072dfb73ef401d4bdf66c2425e240 Mon Sep 17 00:00:00 2001 From: Fred Silberberg Date: Wed, 9 Mar 2022 21:39:55 +0000 Subject: [PATCH] Quote launch paths when necessary Fixes https://github.com/OmniSharp/omnisharp-vscode/issues/5099. --- src/omnisharp/launcher.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/omnisharp/launcher.ts b/src/omnisharp/launcher.ts index 3510b3155..45d86fdd7 100644 --- a/src/omnisharp/launcher.ts +++ b/src/omnisharp/launcher.ts @@ -350,7 +350,7 @@ async function launchDotnet(launchInfo: LaunchInfo, cwd: string, args: string[], } else { command = platformInfo.isWindows() ? 'dotnet.exe' : 'dotnet'; - argsCopy.unshift(launchInfo.DotnetLaunchPath ?? launchInfo.LaunchPath); + argsCopy.unshift(`"${launchInfo.DotnetLaunchPath ?? launchInfo.LaunchPath}"`); } const process = spawn(command, argsCopy, { detached: false, cwd, env: dotnetInfo.env }); @@ -373,7 +373,7 @@ function launchWindows(launchPath: string, cwd: string, args: string[]): LaunchR } let argsCopy = args.slice(0); // create copy of args - argsCopy.unshift(launchPath); + argsCopy.unshift(`"${launchPath}"`); argsCopy = [[ '/s', '/c', @@ -408,7 +408,7 @@ function launchNix(launchPath: string, cwd: string, args: string[]): LaunchResul function launchNixMono(launchPath: string, cwd: string, args: string[], environment: NodeJS.ProcessEnv, useDebugger: boolean): LaunchResult { let argsCopy = args.slice(0); // create copy of details args - argsCopy.unshift(launchPath); + argsCopy.unshift(`$"{launchPath}"`); argsCopy.unshift("--assembly-loader=strict"); if (useDebugger) {