1
0
Fork 0
mirror of https://github.com/shimataro/ssh-key-action.git synced 2025-06-19 22:52:10 +10:00
ssh-key-action/node_modules/spawn-please
2019-09-18 20:37:31 +09:00
..
test * first action! 2019-09-18 20:37:31 +09:00
.editorconfig * first action! 2019-09-18 20:37:31 +09:00
.gitattributes * first action! 2019-09-18 20:37:31 +09:00
.jshintrc * first action! 2019-09-18 20:37:31 +09:00
.npmignore * first action! 2019-09-18 20:37:31 +09:00
.travis.yml * first action! 2019-09-18 20:37:31 +09:00
index.js * first action! 2019-09-18 20:37:31 +09:00
LICENSE * first action! 2019-09-18 20:37:31 +09:00
package.json * first action! 2019-09-18 20:37:31 +09:00
README.md * first action! 2019-09-18 20:37:31 +09:00
yarn.lock * first action! 2019-09-18 20:37:31 +09:00

spawn-please

npm version

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

Install

$ npm install --save spawn-please

Usage

promise = spawn(command, [arguments], [stdin], [options])

options are passed directly through to child_process.spawn.

const spawn = require('spawn-please')

spawn('printf', ['please?'])
  .then(output => {
    assert.equal(output, 'please?')
  })

How is this different than other child_process libraries?

  • Allows you to pass a string to stdin:
spawn('cat', [], 'test')
  .then(output => {
    assert.equal(output, 'test')
  })

  • Rejects on any stderr:
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