yexec
Yet another process execution wrapper. Uses child_process.spawn
to execute an external process and capture stdout
and stderr
.
- Logs
stdout
andstderr
to a logger implementation of your choice as long as it supports the standard level functions likeinfo
,warn
, anderror
. - Supports optional log filter
- Protects against double callbacks from
error
andexit
events. - Throws an Error if process exits with non-zero code
- Specify an optional timeout. If the process has not exited within the interval the process is force killed and a
TIMEOUT
error is thrown.
Usage
npm install yexec
var yexec = ;var winston = ; var params = executable: 'git' args: 'clone' 'https://github.com/nodejs/node.git' logger: winston timeout: 5000 // 5 seconds { return level !== 'info'; }; try await ; catch err // If timeout occurred, err.code will be 'TIMEOUT' winston;