2015-05-19 11:00:06 +00:00
|
|
|
'use strict';
|
2015-12-24 00:02:12 +00:00
|
|
|
require('../common');
|
2016-12-30 23:38:06 +00:00
|
|
|
const fork = require('child_process').fork;
|
2012-08-01 11:39:14 +00:00
|
|
|
|
|
|
|
if (process.argv[2] === 'child') {
|
|
|
|
console.log('child -> call disconnect');
|
|
|
|
process.disconnect();
|
|
|
|
|
|
|
|
setTimeout(function() {
|
|
|
|
console.log('child -> will this keep it alive?');
|
2015-05-19 11:00:06 +00:00
|
|
|
process.on('message', function() { });
|
2012-08-01 11:39:14 +00:00
|
|
|
}, 400);
|
|
|
|
|
|
|
|
} else {
|
2017-01-08 13:19:00 +00:00
|
|
|
const child = fork(__filename, ['child']);
|
2012-08-01 11:39:14 +00:00
|
|
|
|
2015-05-19 11:00:06 +00:00
|
|
|
child.on('disconnect', function() {
|
2012-08-01 11:39:14 +00:00
|
|
|
console.log('parent -> disconnect');
|
|
|
|
});
|
|
|
|
|
2015-05-19 11:00:06 +00:00
|
|
|
child.once('exit', function() {
|
2012-08-01 11:39:14 +00:00
|
|
|
console.log('parent -> exit');
|
|
|
|
});
|
|
|
|
}
|