gh-action-bump-version/tests/end-to-end/exec.js

18 lines
467 B
JavaScript
Raw Normal View History

2021-08-20 23:51:35 +00:00
const execa = require('execa');
module.exports = async function exec(command, options, ...params) {
let suppressOutput;
if (typeof options === 'object') {
suppressOutput = options.suppressOutput;
} else {
params.unshift(options);
suppressOutput = false;
}
const subprocess = execa(command, params);
if (!suppressOutput) {
subprocess.stdout.pipe(process.stdout);
}
subprocess.stderr.pipe(process.stderr);
return await subprocess;
};