Skip to content

Commit 253fd62

Browse files
committed
fixup: revert to previous workaround
1 parent 4624147 commit 253fd62

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

test/parallel/test-cluster-shared-leak.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,22 @@ if (cluster.isMaster) {
1515
worker1 = cluster.fork();
1616
worker1.on('message', common.mustCall(function() {
1717
worker2 = cluster.fork();
18-
// make sure worker2 is listening before doing anything else
19-
cluster.once('listening', function() {
20-
conn = net.connect(common.PORT, common.mustCall(function() {
21-
worker1.send('die');
22-
worker2.send('die');
23-
}));
24-
conn.on('error', function(e) {
25-
// ECONNRESET is OK
26-
if (e.code === 'ECONNRESET')
27-
return;
28-
throw e;
29-
});
18+
worker2.on('error', function(e) {
19+
console.error('worker2 error');
20+
// EPIPE is OK on Windows
21+
if (common.isWindows && e.code === 'EPIPE')
22+
return;
23+
throw e;
24+
});
25+
conn = net.connect(common.PORT, common.mustCall(function() {
26+
worker1.send('die');
27+
worker2.send('die');
28+
}));
29+
conn.on('error', function(e) {
30+
// ECONNRESET is OK
31+
if (e.code === 'ECONNRESET')
32+
return;
33+
throw e;
3034
});
3135
}));
3236

0 commit comments

Comments
 (0)