Files
node/test/parallel/test-child-process-fork-ref2.js
Rich Trott 13241bd24b test: remove unused vars in ChildProcess tests
In addition to removing unused vars, this also fixes an instance where
booleans were set presumably to check something but then never used.
This now confirms that the events that were setting the booleans are
fired.

PR-URL: https://github.com/nodejs/node/pull/4425
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-01-19 11:52:39 -08:00

25 lines
533 B
JavaScript

'use strict';
require('../common');
var fork = require('child_process').fork;
if (process.argv[2] === 'child') {
console.log('child -> call disconnect');
process.disconnect();
setTimeout(function() {
console.log('child -> will this keep it alive?');
process.on('message', function() { });
}, 400);
} else {
var child = fork(__filename, ['child']);
child.on('disconnect', function() {
console.log('parent -> disconnect');
});
child.once('exit', function() {
console.log('parent -> exit');
});
}