medikoo / child-process-ext

Node.js child_process extensions
ISC License
6 stars 2 forks source link

Build status Tests coverage npm version

child-process-ext

Node.js child_process extensions

Installation

npm install child-process-ext

API

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:

Promise resolves with object with three properties:

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

Tests

npm test