mirror of https://github.com/nodejs/node.git
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>pull/36443/head
parent
6d3775e291
commit
ca8eb795be
|
@ -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());
|
||||
}));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue