node/test/parallel/test-child-process-fork-ref2.js

25 lines
533 B
JavaScript
Raw Normal View History

'use strict';
require('../common');
2012-08-01 11:39:14 +00:00
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() { });
2012-08-01 11:39:14 +00:00
}, 400);
} else {
var child = fork(__filename, ['child']);
child.on('disconnect', function() {
2012-08-01 11:39:14 +00:00
console.log('parent -> disconnect');
});
child.once('exit', function() {
2012-08-01 11:39:14 +00:00
console.log('parent -> exit');
});
}