Skip to content

Commit 166aa8a

Browse files
santigimenotargos
authored andcommitted
test: fix child-process-pipe-dataflow
Make sure all the `wc` process stdout data is received before checking its validity. Fixes: #25988 PR-URL: #36366 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 6a6b3af commit 166aa8a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,13 @@ const MB = KB * KB;
6161
}));
6262
});
6363

64+
let wcBuf = '';
6465
wc.stdout.on('data', common.mustCall((data) => {
66+
wcBuf += data;
67+
}));
68+
69+
wc.on('close', common.mustCall(() => {
6570
// Grep always adds one extra byte at the end.
66-
assert.strictEqual(data.toString().trim(), (MB + 1).toString());
71+
assert.strictEqual(wcBuf.trim(), (MB + 1).toString());
6772
}));
6873
}

0 commit comments

Comments
 (0)