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

Add return promise to the Module.runMain() branch. #172

Merged
merged 1 commit into from
Apr 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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