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 <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
santigimeno authored and targos committed Dec 21, 2020
1 parent 6a6b3af commit 166aa8a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/parallel/test-child-process-pipe-dataflow.js
Original file line number Diff line number Diff line change
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 166aa8a

Please sign in to comment.