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 4d916da

Browse filesBrowse files
joyeecheungMylesBorins
authored andcommitted
test: fail when child dies in fork-net
Previously when the child dies with errors in this test, the parent will just hang and timeout, the errors in the child would be swallowed. This makes it fail so at least there is more information about why this test fails. Also removes the unnecessary child.kill() call. PR-URL: #11684 Ref: #11667 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 1158f44 commit 4d916da
Copy full SHA for 4d916da

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+5
-5
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-child-process-fork-net.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-fork-net.js
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
require('../common');
2+
const common = require('../common');
33
const assert = require('assert');
44
const fork = require('child_process').fork;
55
const net = require('net');
@@ -60,9 +60,10 @@ if (process.argv[2] === 'child') {
6060

6161
const child = fork(process.argv[1], ['child']);
6262

63-
child.on('exit', function() {
64-
console.log('CHILD: died');
65-
});
63+
child.on('exit', common.mustCall(function(code, signal) {
64+
const message = `CHILD: died with ${code}, ${signal}`;
65+
assert.strictEqual(code, 0, message);
66+
}));
6667

6768
// send net.Server to child and test by connecting
6869
const testServer = function(callback) {
@@ -171,7 +172,6 @@ if (process.argv[2] === 'child') {
171172

172173
testSocket(function() {
173174
socketSuccess = true;
174-
child.kill();
175175
});
176176
});
177177

0 commit comments

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