summaryrefslogtreecommitdiff
path: root/test/parallel/test-child-process-fork-ref2.js
blob: 3ccdfc1887105565c9b442e40288fd92e25622ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
var common = require('../common');
var assert = require('assert');
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');
  });
}