Skip to content

Commit

Permalink
Use shell: true only on Windows (#224597)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexr00 authored Aug 5, 2024
1 parent dad736b commit 789d5fe
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion extensions/npm/src/features/packageJSONContribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,13 @@ export class PackageJSONContribution implements IJSONContribution {
// COREPACK_ENABLE_PROJECT_SPEC makes the npm view command succeed
// even if packageManager specified a package manager other than npm.
const env = { ...process.env, COREPACK_ENABLE_AUTO_PIN: '0', COREPACK_ENABLE_PROJECT_SPEC: '0' };
cp.execFile(`"${npmCommandPath}"`, args, { cwd, env, shell: true }, (error, stdout) => {
let options: cp.ExecFileOptions = { cwd, env };
let commandPath: string = npmCommandPath;
if (process.platform === 'win32') {
options = { cwd, env, shell: true };
commandPath = `"${npmCommandPath}"`;
}
cp.execFile(commandPath, args, options, (error, stdout) => {
if (!error) {
try {
const content = JSON.parse(stdout);
Expand Down

0 comments on commit 789d5fe

Please sign in to comment.