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-server-close.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-server-close.js')
-rw-r--r-- | test/parallel/test-child-process-server-close.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/parallel/test-child-process-server-close.js b/test/parallel/test-child-process-server-close.js index ec95fed67b..d70926f2e8 100644 --- a/test/parallel/test-child-process-server-close.js +++ b/test/parallel/test-child-process-server-close.js @@ -8,11 +8,11 @@ const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); const server = net.createServer((conn) => { - conn.on('close', common.mustCall()); - spawn(process.execPath, ['-v'], { stdio: ['ignore', conn, 'ignore'] - }).on('close', common.mustCall()); + }).on('close', common.mustCall(() => { + conn.end(); + })); }).listen(common.PIPE, () => { const client = net.connect(common.PIPE, common.mustCall()); client.on('data', () => { |