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 193a020

Browse filesBrowse files
Trotttargos
authored andcommitted
test: increase debugging information in subprocess test
Refs: #25988 (comment) PR-URL: #30761 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent a8bf7db commit 193a020
Copy full SHA for 193a020

File tree

Expand file treeCollapse file tree

1 file changed

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

1 file changed

+11
-1
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-child-process-pipe-dataflow.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-pipe-dataflow.js
+11-1Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ const MB = KB * KB;
3737
cat.stdout._handle.readStart = common.mustNotCall();
3838
grep.stdout._handle.readStart = common.mustNotCall();
3939

40+
// Keep an array of error codes and assert on them during process exit. This
41+
// is because stdio can still be open when a child process exits, and we don't
42+
// want to lose information about what caused the error.
43+
const errors = [];
44+
process.on('exit', () => {
45+
assert.deepStrictEqual(errors, []);
46+
});
47+
4048
[cat, grep, wc].forEach((child, index) => {
4149
const errorHandler = (thing, type) => {
4250
// Don't want to assert here, as we might miss error code info.
@@ -46,7 +54,9 @@ const MB = KB * KB;
4654
child.stderr.on('data', (d) => { errorHandler(d, 'data'); });
4755
child.on('error', (err) => { errorHandler(err, 'error'); });
4856
child.on('exit', common.mustCall((code) => {
49-
assert.strictEqual(code, 0, `child ${index} exited with code ${code}`);
57+
if (code !== 0) {
58+
errors.push(`child ${index} exited with code ${code}`);
59+
}
5060
}));
5161
});
5262

0 commit comments

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