diff --git a/index.js b/index.js index e65cd72..4af3d87 100644 --- a/index.js +++ b/index.js @@ -253,7 +253,7 @@ function installPackages (specs, prefix, opts) { module.exports._execCommand = execCommand function execCommand (_existing, argv) { return findNodeScript(_existing, argv).then(existing => { - if (existing && !argv.nodeArg && !argv.shell && existing !== process.argv[1]) { + if (existing && !argv.alwaysSpawn && !argv.nodeArg && !argv.shell && existing !== process.argv[1]) { const Module = require('module') // let it take over the process. This means we can skip node startup! if (!argv.noYargs) { diff --git a/locales/en.json b/locales/en.json index 358e343..d3463ae 100644 --- a/locales/en.json +++ b/locales/en.json @@ -25,5 +25,6 @@ "package": "package", "npx: installed %s in %ss": "npx: installed %s in %ss", "Suppress output from npx itself. Subcommands will not be affected.": "Suppress output from npx itself. Subcommands will not be affected.", - "Extra node argument when calling a node binary.": "Extra node argument when calling a node binary." + "Extra node argument when calling a node binary.": "Extra node argument when calling a node binary.", + "Always spawn a child process to execute the command.": "Always spawn a child process to execute the command." } \ No newline at end of file diff --git a/parse-args.js b/parse-args.js index 3f50660..d655442 100644 --- a/parse-args.js +++ b/parse-args.js @@ -179,6 +179,10 @@ function yargsParser (argv, defaultNpm) { type: 'string', describe: Y()`Location of the npm cache.` }) + .option('always-spawn', { + describe: Y()`Always spawn a child process to execute the command.`, + type: 'boolean' + }) .option('no-install', { type: 'boolean', describe: Y()`Skip installation if a package is missing.`