1'use strict';
2const common = require('../common');
3const cluster = require('cluster');
4const assert = require('assert');
5
6if (cluster.isPrimary) {
7  const worker = cluster.fork();
8
9  worker.on('online', common.mustCall(() => {
10    // Use worker.process.kill() instead of worker.kill() because the latter
11    // waits for a graceful disconnect, which will never happen.
12    worker.process.kill();
13  }));
14
15  worker.on('exit', common.mustCall((code, signal) => {
16    assert.strictEqual(code, null);
17    assert.strictEqual(signal, 'SIGTERM');
18  }));
19} else {
20  while (true);
21}
22