diff --git a/tasks/util/exec-file.js b/tasks/util/exec-file.js index 66fd8e92a..bcd685f15 100644 --- a/tasks/util/exec-file.js +++ b/tasks/util/exec-file.js @@ -1,10 +1,7 @@ const childProcess = require('child_process'); -const fs = require('fs'); -const path = require('path'); module.exports = { - execNodeJsScriptWithInheritedOutput, - execFileWithInheritedOutput + execNodeJsScriptWithInheritedOutput }; async function execNodeJsScriptWithInheritedOutput(command, args) { @@ -18,34 +15,3 @@ async function execNodeJsScriptWithInheritedOutput(command, args) { }); }); } - -async function execFileWithInheritedOutput(command, args) { - return new Promise((resolve, reject) => { - const resolvedCommand = preferLocalDependencies(command); - const child = childProcess.spawn(resolvedCommand, args, { - stdio: 'inherit' - }); - child.on('exit', code => { - if (code !== 0) { - reject(new Error(`Child process failed with exit-code ${code}`)); - } - resolve(); - }); - }); -} - -function preferLocalDependencies(command) { - const localCandidate = resolveLocalCandidate(command); - - if (fs.existsSync(localCandidate)) { - return localCandidate; - } - return command; -} - -function resolveLocalCandidate(command) { - if (process.platform === 'win32') { - return path.join('node_modules', '.bin', command + '.cmd'); - } - return path.join('node_modules', '.bin', command); -}