Skip to content

Instantly share code, notes, and snippets.

@cb1kenobi
Created September 14, 2022 21:57
Show Gist options
  • Save cb1kenobi/d9e8013c69aba6d293e2fbc3cce2b57c to your computer and use it in GitHub Desktop.
Save cb1kenobi/d9e8013c69aba6d293e2fbc3cce2b57c to your computer and use it in GitHub Desktop.
function spawn(command, args, options) {
// Parse the arguments
const parsed = parse(command, args, options);
// Spawn the child process
const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
// Hook into child process "exit" event to emit an error if the command
// does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
enoent.hookChildProcess(spawned, parsed);
return spawned;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment