Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const execLive = async function (command, options = {}) {
if (!command) {
throw new Error('Command is missing.');
}
const cwd = options.cwd || process.cwd(),
env = options.env || processenv(),
maxBuffer = options.maxBuffer || 1024 * 200;
let args,
binary;
if (options.args) {
binary = command;
({ args } = options);
} else {
[ binary, ...args ] = command.split(' ');
}
const childProcess = execa(binary, args, { cwd, env, maxBuffer });
if (options.silent !== true) {
childProcess.stdout.on('data', data => ui.passThrough(data));
childProcess.stderr.on('data', data => ui.passThrough(data, { target: 'stderr' }));