spawn-please
Promisified child_process.spawn. *Supports stdin* *Rejects on stderr*
Last updated 5 years ago by raine .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install spawn-please 
SYNC missed versions from official npm registry.

spawn-please

npm version

Promisified child_process.spawn. *Supports stdin* *Rejects on stderr*

Install

$ npm install --save spawn-please

Usage

await spawn(command, [arguments], [stdin], [options])

options are passed directly to child_process.spawn.

const spawn = require('spawn-please')

const output = await spawn('printf', ['please?'])
assert.equal(output, 'please?')

How is this different than other child_process libraries?

  • Allows you to pass a string to stdin:
const output = await spawn('cat', [], 'test')
assert.equal(output, 'test')

  • Rejects on any stderr:
try {
  spawn('some-command-with-stderr')
}
catch (stderr) {
  // do something with stderr
}

Using your own Promise library

spawn-please uses the global Promise object by default. You may use your own Promise library by overriding the Promise property:

const spawn = require('spawn-please')
spawn.Promise = require('bluebird')

License

ISC © Raine Revere

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

6 Versions

  • 1.0.0                                ...           5 years ago
  • 0.4.1                                ...           6 years ago
  • 0.4.0                                ...           6 years ago
  • 0.3.0                                ...           9 years ago
  • 0.2.0                                ...           9 years ago
  • 0.1.0                                ...           11 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (14)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |