code: function spawn_cmd(command, args, options) {
    if (!options) options = {}
  
    return new Promise((resolve, reject) => {
      let io = {stdout: [], stderr: []}
      let finish = () =>
        ({stdout: io.stdout.join(''), stderr: io.stderr.join('')})
  
      let child = child_process.spawn(command, args,
        Object.assign({stdio:'pipe'}, options))
  
      if (options.input) {
        child.stdin.write(options.input)
        child.stdin.end()
      } else if (options.stdin)
        options.stdin.pipe(child.stdin)
  
      child.on('error', err => reject( Object.assign({err, command, args}, finish()) ))
      child.on('exit', (exitCode,  exitSignal) => exitCode
         ? reject( Object.assign({exitCode, exitSignal, command, args}, finish()) )
         : resolve(finish()))
  
      child.stdout.on('data', data => io.stdout.push(data) )
      child.stderr.on('data', data => io.stderr.push(data) )
      return child })}
docs: child_process.spawn with {stdout, stderr}, Promises