JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 100
  • Score
    100M100P100Q91824F
  • License MIT

spawn which returns a process with a promise property, fulfilled with { code, stdout, stderr }

Package Exports

  • spawncommand

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (spawncommand) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

spawncommand

extend require('child_process').spawn to set .promise property on the returned object. The promise will be fulfilled on process exit with a hash of code, stdout and stderr, where code is the exit code, stdout is all data the process wrote to stdout, and stderr is all data the process wrote to stderr. The promise will be rejected if process.on('error') fired.

npm i --save spawncommand
const spawnCommand = require('spawncommand')

const echo = spawnCommand('echo', ['hello world'])
echo
    .promise
    .then((res) => {
        console.error(res)
    })
    // { code: 0, stdout: 'hello world', stderr: '' }
    // echo is instance of ChildProcess)

Testing

zoroaster

npm t

> spawncommand@1.0.0 test /Users/zavr/Work/spawnCommand
> zoroaster test/spec

 test/spec
   index.js
    ✓  spawnCommand
    ✓  spawnExit0Command
    ✓  spawnExit1Command
    ✓  spanwWithNoChannels
    ✓  spawnError
     message
      ✓  stdout
      ✓  stderr
      ✓  exit0
      ✓  exit1

Executed 9 tests.