summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSantiago Gimeno <santiago.gimeno@gmail.com>2020-12-03 10:38:28 +0100
committerNode.js GitHub Bot <github-bot@iojs.org>2020-12-08 05:23:36 +0000
commitca8eb795be7e2fb37fa5247feeb10e38fb98e63d (patch)
tree74c52be4a55f22f70aa24c3e2d8c17a782b42f08 /test
parent6d3775e29117d8ddf6879ed124dea7839a613986 (diff)
downloadios-node-v8-ca8eb795be7e2fb37fa5247feeb10e38fb98e63d.tar.gz
ios-node-v8-ca8eb795be7e2fb37fa5247feeb10e38fb98e63d.tar.bz2
ios-node-v8-ca8eb795be7e2fb37fa5247feeb10e38fb98e63d.zip
test: fix child-process-pipe-dataflow
Make sure all the `wc` process stdout data is received before checking its validity. Fixes: https://github.com/nodejs/node/issues/25988 PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'test')
-rw-r--r--test/parallel/test-child-process-pipe-dataflow.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/parallel/test-child-process-pipe-dataflow.js b/test/parallel/test-child-process-pipe-dataflow.js
index 5f425a6f3d..31846c8a71 100644
--- a/test/parallel/test-child-process-pipe-dataflow.js
+++ b/test/parallel/test-child-process-pipe-dataflow.js
@@ -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());
}));
}