diff --git a/test/parallel/test-child-process-fork-closed-channel-segfault.js b/test/parallel/test-child-process-fork-closed-channel-segfault.js index 14cb4b8fd97ae9..c24a62379bf66e 100644 --- a/test/parallel/test-child-process-fork-closed-channel-segfault.js +++ b/test/parallel/test-child-process-fork-closed-channel-segfault.js @@ -31,6 +31,16 @@ const server = net .listen(0, function() { const worker = cluster.fork(); + worker.on('error', function(err) { + if ( + err.code !== 'ECONNRESET' && + err.code !== 'ECONNREFUSED' && + err.code !== 'EMFILE' + ) { + throw err; + } + }); + function send(callback) { const s = net.connect(server.address().port, function() { worker.send({}, s, callback); @@ -66,7 +76,10 @@ const server = net send(function(err) { // Ignore errors when sending the second handle because the worker // may already have exited. - if (err && err.code !== 'ERR_IPC_CHANNEL_CLOSED') { + if (err && err.code !== 'ERR_IPC_CHANNEL_CLOSED' && + err.code !== 'ECONNRESET' && + err.code !== 'ECONNREFUSED' && + err.code !== 'EMFILE') { throw err; } });