mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
29ec7e9331
PR-URL: https://github.com/nodejs/node/pull/51929 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
23 lines
541 B
JavaScript
23 lines
541 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const net = require('net');
|
|
const cluster = require('cluster');
|
|
|
|
// Process should exit
|
|
if (cluster.isPrimary) {
|
|
cluster.fork();
|
|
} else {
|
|
const send = process.send;
|
|
process.send = function(message) {
|
|
// listenOnPrimaryHandle in net.js should call handle.close()
|
|
if (message.act === 'close') {
|
|
setImmediate(() => {
|
|
process.disconnect();
|
|
});
|
|
}
|
|
return send.apply(this, arguments);
|
|
};
|
|
net.createServer().listen(0, common.mustNotCall()).close();
|
|
}
|