From 9936b2d78b15e8963b0cceb97d032cc74fb2d282 Mon Sep 17 00:00:00 2001 From: ehmicky Date: Wed, 19 Jun 2019 10:00:00 +0200 Subject: [PATCH] Refactor entry point of `execa.node()` --- index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 8af6259712..6db8535925 100644 --- a/index.js +++ b/index.js @@ -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 : []) ],