
Security News
The Next Open Source Security Race: Triage at Machine Speed
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.
child-exit-nodeback
Advanced tools
Observe a child_process's 'exit' and 'close' events and transform them into events with nodeback-style arguments (error, child).
Observe a child_process's 'exit' and 'close' events and transform them into events with nodeback-style arguments (error, child).
This module exports one function:
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 reference to ee in its src property,
and at least one of the properties retval (the exit code) or signal.
from test.usage.js:
var childExitNodeback = require('child-exit-nodeback'),
spawn = require('child_process').spawn;
function spawnNodeEval(js) { return spawn(process.execPath, ['-e', js]); }
test.add(function () {
var child = spawnNodeEval('// no-op');
equal(typeof child.pid, 'number');
childExitNodeback(child);
child.once('exit:nodeback', test.log.args('no-op exit'));
child.once('close:nodeback', test.log.args('no-op close'));
test.log.expect([
[ 'no-op exit', false, '{ChildProcess}' ],
[ 'no-op close', false, '{ChildProcess}' ],
]);
});
test.add(function () {
var child = childExitNodeback(spawnNodeEval('process.exit(42)'));
equal(typeof child.pid, 'number');
child.once('exit:nodeback', test.log.args('42 exit'));
child.once('close:nodeback', test.log.args('42 close'));
test.log.expect([
[ '42 exit', '{Error "Exit status 42"}', '{ChildProcess}' ],
[ '42 close', '{Error "Exit status 42"}', '{ChildProcess}' ],
]);
});
test.add(function () {
var child = spawnNodeEval('setTimeout(Function, 1e4);' +
'process.kill(process.pid, "SIGHUP");');
childExitNodeback(child);
child.once('exit:nodeback', test.log.args('hup exit'));
child.once('close:nodeback', test.log.args('hup close'));
test.log.expect([
[ 'hup exit', '{Error "Killed by signal SIGHUP"}', '{ChildProcess}' ],
[ 'hup close', '{Error "Killed by signal SIGHUP"}', '{ChildProcess}' ],
]);
});
ISC
FAQs
Observe a child_process's 'exit' and 'close' events and transform them into events with nodeback-style arguments (error, child).
The npm package child-exit-nodeback receives a total of 1 weekly downloads. As such, child-exit-nodeback popularity was classified as not popular.
We found that child-exit-nodeback demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.

Research
/Security News
Malicious dYdX client packages were published to npm and PyPI after a maintainer compromise, enabling wallet credential theft and remote code execution.

Security News
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.