diff --git a/src/index.ts b/src/index.ts index 7e2d0a82..bf7a7620 100755 --- a/src/index.ts +++ b/src/index.ts @@ -174,7 +174,6 @@ const install = async ( // See: https://github.com/raineorshine/npm-check-updates/issues/1191 ...(packageManager === 'pnpm' ? { npm_config_strict_peer_dependencies: false } : null), }, - shell: process.platform === 'win32', }, ) print(options, stdout) diff --git a/src/package-managers/npm.ts b/src/package-managers/npm.ts index ee0a0079..910775d1 100644 --- a/src/package-managers/npm.ts +++ b/src/package-managers/npm.ts @@ -609,17 +609,15 @@ export async function defaultPrefix(options: Options): Promise getInstalledPackages if (!options.global) return npm.list(options) - const spawnOptions = {} const cmd = process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm' - const sanitzedSpawnOptions = process.platform === 'win32' ? { ...spawnOptions, shell: true } : spawnOptions - const { stdout } = await spawn(cmd, ['ls', '-g', '--json'], {}, sanitzedSpawnOptions) + const { stdout } = await spawn(cmd, ['ls', '-g', '--json']) const result = JSON.parse(stdout) as PnpmList const list = keyValueBy(result[0].dependencies || {}, (name, { version }) => ({ [name]: version, @@ -93,11 +91,10 @@ export const semver = withNpmWorkspaceConfig(npm.semver) async function spawnPnpm( args: string | string[], npmOptions: NpmOptions = {}, - spawnOptions: SpawnOptions = {}, + spawnOptions?: SpawnOptions, spawnPleaseOptions?: SpawnPleaseOptions, ): Promise { const cmd = process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm' - const sanitzedSpawnOptions = process.platform === 'win32' ? { ...spawnOptions, shell: true } : spawnOptions const fullArgs = [ ...(npmOptions.global ? 'global' : []), @@ -105,7 +102,7 @@ async function spawnPnpm( ...(npmOptions.prefix ? `--prefix=${npmOptions.prefix}` : []), ] - const { stdout } = await spawn(cmd, fullArgs, spawnPleaseOptions, sanitzedSpawnOptions) + const { stdout } = await spawn(cmd, fullArgs, spawnPleaseOptions, spawnOptions) return stdout } diff --git a/src/package-managers/yarn.ts b/src/package-managers/yarn.ts index bb9db2f9..e27b864d 100644 --- a/src/package-managers/yarn.ts +++ b/src/package-managers/yarn.ts @@ -225,12 +225,10 @@ export async function defaultPrefix(options: Options): Promise { if (options.prefix) { return Promise.resolve(options.prefix) } - const spawnOptions = {} const cmd = process.platform === 'win32' ? 'yarn.cmd' : 'yarn' - const sanitizedSpawnOptions = process.platform === 'win32' ? { ...spawnOptions, shell: true } : spawnOptions - const { stdout: prefix } = await spawn(cmd, ['global', 'dir'], {}, sanitizedSpawnOptions) + const { stdout: prefix } = await spawn(cmd, ['global', 'dir']) // yarn 2.0 does not support yarn global // catch error to prevent process from crashing // https://github.com/raineorshine/npm-check-updates/issues/873 diff --git a/src/types/SpawnOptions.ts b/src/types/SpawnOptions.ts index a47401c0..fff99f8c 100644 --- a/src/types/SpawnOptions.ts +++ b/src/types/SpawnOptions.ts @@ -4,5 +4,4 @@ import { Index } from './IndexType' export interface SpawnOptions { cwd?: string env?: Index - shell?: boolean }