Skip to content

Commit a5da04c

Browse files
authored
Merge pull request #5154 from JoeRobich/quote-workspace-path
Quote arguments containing spaces when launching OmniSharp.
2 parents cf43f67 + 114ca49 commit a5da04c

File tree

3 files changed

+32
-28
lines changed

3 files changed

+32
-28
lines changed

package-lock.json

Lines changed: 26 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858
"gulp": "gulp"
5959
},
6060
"dependencies": {
61+
"@types/cross-spawn": "^6.0.2",
6162
"async-file": "2.0.2",
63+
"cross-spawn": "^6.0.5",
6264
"fs-extra": "9.1.0",
6365
"http-proxy-agent": "4.0.1",
6466
"https-proxy-agent": "5.0.0",

src/omnisharp/launcher.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { spawn, ChildProcess } from 'child_process';
6+
import { spawn } from 'cross-spawn';
7+
import { ChildProcess } from 'child_process';
78

89
import { PlatformInformation } from '../platform';
910
import * as path from 'path';
@@ -343,17 +344,16 @@ async function launchDotnet(launchInfo: LaunchInfo, cwd: string, args: string[],
343344
let command: string;
344345
const argsCopy = args.slice(0);
345346

346-
347347
if (launchInfo.LaunchPath && !launchInfo.LaunchPath.endsWith('.dll')) {
348348
// If we're not being asked to launch a dll, assume whatever we're given is an executable
349349
command = launchInfo.LaunchPath;
350350
}
351351
else {
352352
command = platformInfo.isWindows() ? 'dotnet.exe' : 'dotnet';
353-
argsCopy.unshift(`"${launchInfo.DotnetLaunchPath ?? launchInfo.LaunchPath}"`);
353+
argsCopy.unshift(launchInfo.DotnetLaunchPath ?? launchInfo.LaunchPath);
354354
}
355355

356-
const process = spawn(command, argsCopy, { detached: false, cwd, env: dotnetInfo.env, shell: true });
356+
const process = spawn(command, argsCopy, { detached: false, cwd, env: dotnetInfo.env });
357357

358358
return {
359359
process,

0 commit comments

Comments
 (0)