diff --git a/test/parallel/test-child-process-fork-net.js b/test/parallel/test-child-process-fork-net.js index cfc8f564d2a03a..7646cb5926305d 100644 --- a/test/parallel/test-child-process-fork-net.js +++ b/test/parallel/test-child-process-fork-net.js @@ -158,6 +158,11 @@ if (process.argv[2] === 'child') { console.log('PARENT: server closed'); callback(); }); + server.on('error', (err) => { + if (err && err.code !== 'EPIPE') { + throw err; + } + }); // Don't listen on the same port, because SmartOS sometimes says // that the server's fd is closed, but it still cannot listen // on the same port again. @@ -175,7 +180,11 @@ if (process.argv[2] === 'child') { connect.on('close', function() { console.log('CLIENT: closed'); assert.strictEqual(store, 'echo'); - server.close(); + server.close((err) => { + if (err && err.code !== 'EPIPE') { + throw err; + } + }); }); }); }