Skip to content

Commit

Permalink
Use cross-spawn package for launch OmniSharp
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich committed Apr 5, 2022
1 parent cf43f67 commit 114ca49
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 28 deletions.
50 changes: 26 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@
"gulp": "gulp"
},
"dependencies": {
"@types/cross-spawn": "^6.0.2",
"async-file": "2.0.2",
"cross-spawn": "^6.0.5",
"fs-extra": "9.1.0",
"http-proxy-agent": "4.0.1",
"https-proxy-agent": "5.0.0",
Expand Down
8 changes: 4 additions & 4 deletions src/omnisharp/launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { spawn, ChildProcess } from 'child_process';
import { spawn } from 'cross-spawn';
import { ChildProcess } from 'child_process';

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


if (launchInfo.LaunchPath && !launchInfo.LaunchPath.endsWith('.dll')) {
// If we're not being asked to launch a dll, assume whatever we're given is an executable
command = launchInfo.LaunchPath;
}
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, shell: true });
const process = spawn(command, argsCopy, { detached: false, cwd, env: dotnetInfo.env });

return {
process,
Expand Down

0 comments on commit 114ca49

Please sign in to comment.