summaryrefslogtreecommitdiff
path: root/test/parallel/test-cluster-worker-death.js
blob: 7a33721a9aba17a322a9aea8db1f9acd5b3cf352 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';
const common = require('../common');
const assert = require('assert');
const cluster = require('cluster');

if (!cluster.isMaster) {
  process.exit(42);
} else {
  const worker = cluster.fork();
  worker.on('exit', common.mustCall(function(exitCode, signalCode) {
    assert.strictEqual(exitCode, 42);
    assert.strictEqual(signalCode, null);
  }));
  cluster.on('exit', common.mustCall(function(worker_) {
    assert.strictEqual(worker_, worker);
  }));
}