Files
Kmake/test/parallel/test-net-server-close-before-ipc-response.js

23 lines
541 B
JavaScript
Raw Permalink Normal View History

2026-05-26 23:36:42 -07:00
'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();
}