Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fafffd4

Browse filesBrowse files
santigimenoMyles Borins
authored andcommitted
test: fix test-child-process-fork-regr-gh-2847
It's not guaranteed that the first socket that tries to connect is the first that succeeds so the rest of assumptions made in the test are not correct. Fix it by making sure the second socket does not try to connect until the first has succeeded. The IPC channel can already be closed when sending the second socket. It should be allowed. Also, don't start sending messages until the worker is online. Fixes: #8950 PR-URL: #8954 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 3b448a7 commit fafffd4
Copy full SHA for fafffd4

File tree

Expand file treeCollapse file tree

1 file changed

+14
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-9
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-child-process-fork-regr-gh-2847.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-fork-regr-gh-2847.js
+14-9Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,19 @@ var server = net.createServer(function(s) {
4949
server.close();
5050
}));
5151

52-
send();
53-
send(function(err) {
54-
// Ignore errors when sending the second handle because the worker
55-
// may already have exited.
56-
if (err) {
57-
if (err.code !== 'ECONNREFUSED') {
58-
throw err;
59-
}
60-
}
52+
worker.on('online', function() {
53+
send(function(err) {
54+
assert.ifError(err);
55+
send(function(err) {
56+
// Ignore errors when sending the second handle because the worker
57+
// may already have exited.
58+
if (err) {
59+
if ((err.message !== 'channel closed') &&
60+
(err.code !== 'ECONNREFUSED')) {
61+
throw err;
62+
}
63+
}
64+
});
65+
});
6166
});
6267
});

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.