2015-05-19 11:00:06 +00:00
|
|
|
'use strict';
|
2016-07-15 19:43:24 +00:00
|
|
|
const common = require('../common');
|
2012-04-23 13:58:32 +00:00
|
|
|
var assert = require('assert');
|
|
|
|
var cluster = require('cluster');
|
|
|
|
|
|
|
|
if (!cluster.isMaster) {
|
|
|
|
process.exit(42);
|
2016-07-09 00:17:47 +00:00
|
|
|
} else {
|
2012-04-23 13:58:32 +00:00
|
|
|
var worker = cluster.fork();
|
2016-07-15 19:43:24 +00:00
|
|
|
worker.on('exit', common.mustCall(function(exitCode, signalCode) {
|
2012-05-02 16:38:31 +00:00
|
|
|
assert.equal(exitCode, 42);
|
|
|
|
assert.equal(signalCode, null);
|
2016-07-15 19:43:24 +00:00
|
|
|
}));
|
|
|
|
cluster.on('exit', common.mustCall(function(worker_) {
|
2012-04-23 13:58:32 +00:00
|
|
|
assert.equal(worker_, worker);
|
2016-07-15 19:43:24 +00:00
|
|
|
}));
|
2012-04-23 13:58:32 +00:00
|
|
|
}
|