Skip to content

Commit

Permalink
test: fix child-process-pipe-dataflow
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
santigimeno authored and targos committed May 1, 2021
1 parent cd06521 commit 0e821ff
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/parallel/test-child-process-pipe-dataflow.js
Expand Up @@ -61,8 +61,13 @@ const MB = KB * KB;
}));
});

let wcBuf = '';
wc.stdout.on('data', common.mustCall((data) => {
wcBuf += data;
}));

wc.on('close', common.mustCall(() => {
// Grep always adds one extra byte at the end.
assert.strictEqual(data.toString().trim(), (MB + 1).toString());
assert.strictEqual(wcBuf.trim(), (MB + 1).toString());
}));
}

0 comments on commit 0e821ff

Please sign in to comment.