2019-10-29 14:15:36 +00:00
|
|
|
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
const cluster = require('cluster');
|
|
|
|
|
2020-12-10 21:53:44 +00:00
|
|
|
if (cluster.isPrimary) {
|
2019-10-29 14:15:36 +00:00
|
|
|
cluster.settings.serialization = 'advanced';
|
|
|
|
const worker = cluster.fork();
|
|
|
|
const circular = {};
|
|
|
|
circular.circular = circular;
|
|
|
|
|
|
|
|
worker.on('online', common.mustCall(() => {
|
|
|
|
worker.send(circular);
|
|
|
|
|
|
|
|
worker.on('message', common.mustCall((msg) => {
|
|
|
|
assert.deepStrictEqual(msg, circular);
|
|
|
|
worker.kill();
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
} else {
|
|
|
|
process.on('message', (msg) => process.send(msg));
|
|
|
|
}
|