Extensions to Node.js child_process module
npm install child-process-ext[![Build status][build-image]][build-url]
[![Tests coverage][cov-image]][cov-url]
[![npm version][npm-image]][npm-url]
child_process extensions``bash`
npm install child-process-ext
#### spawn(command[, args[, options]])
Cross system compliant spawn (backed by cross-spawn).
Works exactly same way as node's spawn with difference that promise is returned that resolves once process exits.
Following properties are exposed on return promise:
- child - child processstdout
- - stdout stream (decorated so it can also be used as promise)stderr
- - stderr stream (decorated so it can also be used as promise)std
- - Merged stdout & stderr stream (decorated so it can also be used as promise)stdoutBuffer
- - Buffer that exposes so far written stdoutstderrBuffer
- - Buffer that exposes so far written stderrrstdBuffer
- - Buffer that exposes so far written std
Promise resolves with object with three properties:
- code - Exit code of a child processignal
- - Signal that terminated the processstdoutBuffer
- - Buffer containing gathered stdout contentstderrBuffer
- - Buffer containing gathered stderr contentstdBuffer
- - Buffer containing gathered stderr content
If process exits with non zero code, then promise is rejected with an error exposing same properties as above
##### Non standard options
###### split bool (default: false)
Whether stdout data should be split by lines. If set to true, then stdout and stderr on promise expose mappers of original stdout and stderr that emit each line with distinct data event
###### shouldCloseStdin bool (default: false)
Whether stdin should be closed. Applicable for spawned processes where stdin is set to other than 'inherit' mode, and underlying processes is reading from stdin. Not providing any stdin output, may produce stall if process logic waits for an input.
_See: get-stdin#13 for more information_
`bash``
npm test
[build-image]: https://github.com/medikoo/child-process-ext/workflows/Integrate/badge.svg
[build-url]: https://github.com/medikoo/child-process-ext/actions?query=workflow%3AIntegrate
[cov-image]: https://img.shields.io/codecov/c/github/medikoo/child-process-ext.svg
[cov-url]: https://codecov.io/gh/medikoo/child-process-ext
[npm-image]: https://img.shields.io/npm/v/child-process-ext.svg
[npm-url]: https://www.npmjs.com/package/child-process-ext