Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

Commit

Permalink
feat(spawn): add --always-spawn to opt out of process takeover optimi…
Browse files Browse the repository at this point in the history
…zation feature (#172)
  • Loading branch information
jdalton authored and zkat committed Apr 12, 2018
1 parent 6e89dbd commit c0d6abc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
4 changes: 4 additions & 0 deletions parse-args.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.`
Expand Down

0 comments on commit c0d6abc

Please sign in to comment.