mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
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>
This commit is contained in:
committed by
Node.js GitHub Bot
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());
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user