diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-04-23 21:08:14 +0200 |
---|---|---|
committer | Gireesh Punathil <gpunathi@in.ibm.com> | 2019-04-29 20:01:27 +0530 |
commit | cc7b3fbaab2f0b4788e209178fd78eda88d65375 (patch) | |
tree | b27457c0deddb5b4f070b5f1081a1e0afc2d21c7 /test/parallel/test-child-process-pipe-dataflow.js | |
parent | 413256d5e8fe01955b8666fea7f1fb29d072fa55 (diff) | |
download | android-node-v8-cc7b3fbaab2f0b4788e209178fd78eda88d65375.tar.gz android-node-v8-cc7b3fbaab2f0b4788e209178fd78eda88d65375.tar.bz2 android-node-v8-cc7b3fbaab2f0b4788e209178fd78eda88d65375.zip |
child_process: only stop readable side of stream passed to proc
Closing the underlying resource completely has the unwanted side effect
that the stream can no longer be used at all, including passing it
to other child processes.
What we want to avoid is accidentally reading from the stream;
accordingly, it should be sufficient to stop its readable side
manually, and otherwise leave the underlying resource intact.
Fixes: https://github.com/nodejs/node/issues/27097
Refs: https://github.com/nodejs/node/pull/21209
PR-URL: https://github.com/nodejs/node/pull/27373
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'test/parallel/test-child-process-pipe-dataflow.js')
-rw-r--r-- | test/parallel/test-child-process-pipe-dataflow.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/parallel/test-child-process-pipe-dataflow.js b/test/parallel/test-child-process-pipe-dataflow.js index f5068b5d36..88a31f4ff8 100644 --- a/test/parallel/test-child-process-pipe-dataflow.js +++ b/test/parallel/test-child-process-pipe-dataflow.js @@ -33,6 +33,10 @@ const MB = KB * KB; grep = spawn('grep', ['x'], { stdio: [cat.stdout, 'pipe', 'pipe'] }); wc = spawn('wc', ['-c'], { stdio: [grep.stdout, 'pipe', 'pipe'] }); + // Extra checks: We never try to start reading data ourselves. + cat.stdout._handle.readStart = common.mustNotCall(); + grep.stdout._handle.readStart = common.mustNotCall(); + [cat, grep, wc].forEach((child, index) => { child.stderr.on('data', (d) => { // Don't want to assert here, as we might miss error code info. |