Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove unused parser tests
Parser tests are not used anymore, since the parser is
now living in a separate package.
  • Loading branch information
jaylinski committed Oct 14, 2022
1 parent 69dbe65 commit 903ca50
Showing 1 changed file with 1 addition and 35 deletions.
36 changes: 1 addition & 35 deletions 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) {
Expand All @@ -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);
}

0 comments on commit 903ca50

Please sign in to comment.