Skip to content

Commit

Permalink
Refactor entry point of execa.node() (#305)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky authored and sindresorhus committed Jun 19, 2019
1 parent 0d4a97a commit 03d7be2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions index.js
Expand Up @@ -523,19 +523,20 @@ module.exports.commandSync = (command, options) => {
return execa.sync(file, args, options);
};

module.exports.node = (scriptPath, args, options) => {
module.exports.node = (scriptPath, args, options = {}) => {
if (args && !Array.isArray(args) && typeof args === 'object') {
options = args;
args = [];
}

const stdioOption = stdio.node(options);
options = options || {};

const {nodePath = process.execPath, nodeArguments = process.execArgv} = options;

return execa(
options.nodePath || process.execPath,
nodePath,
[
...(options.nodeArguments || process.execArgv),
...nodeArguments,
scriptPath,
...(Array.isArray(args) ? args : [])
],
Expand Down

0 comments on commit 03d7be2

Please sign in to comment.