child-exit-nodeback
Observe a child_process's 'exit' and 'close' events and transform them into events with nodeback-style arguments (error, child).
API
This module exports one function:
childExitNodeback(ee)
Given an EventEmitter ee
(e.g. a child process object), subscribes to
the next exit
and close
event and re-emits them as described below.
Returns ee
.
The re-emited events are named exit:nodeback
and close:nodeback
.
Their 2nd argument always is ee
.
The 1st argument is either false
or an Error object, depending on the
first two arguments of the original event interpreted as exit status
and kill signal, as a child_process
would fire them.
The Error object will carry a property src
which is set to ee
,
and at least one of the properties retval
(the exit code) or signal
.
Usage
from test.usage.js:
var childExitNodeback = spawn = spawn; { return ; } test; test; test;
Known issues
- needs more/better tests and docs
License
ISC