How to use the cross-spawn.sync.apply function in cross-spawn

To help you get started, we’ve selected a few cross-spawn examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github egoist / kanpai / lib / publish.js View on Github external
function spawn() {
  const command = spawnSync.apply(null, arguments)
  const hasError = command.status !== 0
  const stderr = command.stderr && command.stderr.toString().trim()
  const sigint = command.signal === 'SIGINT'
  if (hasError || stderr || sigint) {
    let errorMessage = command.error && command.error.message
    if (stderr) {
      errorMessage = stderr
    } else if (sigint) {
      errorMessage = 'Unexpected exited with signal SIGINT'
    }
    if (errorMessage) {
      console.log(errorMessage)
    }
    failed(command.status)
  } else {
    return command