diff options
author | kohta ito <kohta110@gmail.com> | 2018-09-17 16:16:44 +0900 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-03-07 17:38:39 +0100 |
commit | 1133e0bf8b6f63a569b0788dde82f62bc08534ac (patch) | |
tree | 683f9218db84dfa28ba5feab3c393c3fafd36757 /test | |
parent | 82a256ac6740b7a6d29439af911b86a7a0b2e63f (diff) | |
download | android-node-v8-1133e0bf8b6f63a569b0788dde82f62bc08534ac.tar.gz android-node-v8-1133e0bf8b6f63a569b0788dde82f62bc08534ac.tar.bz2 android-node-v8-1133e0bf8b6f63a569b0788dde82f62bc08534ac.zip |
child_process: fire close event from stdio
PR-URL: https://github.com/nodejs/node/pull/22892
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-child-process-server-close.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/parallel/test-child-process-server-close.js b/test/parallel/test-child-process-server-close.js new file mode 100644 index 0000000000..f03203cdab --- /dev/null +++ b/test/parallel/test-child-process-server-close.js @@ -0,0 +1,20 @@ +'use strict'; + +const common = require('../common'); +const { spawn } = require('child_process'); +const net = require('net'); + +const server = net.createServer((conn) => { + conn.on('close', common.mustCall()); + + spawn(process.execPath, ['-v'], { + stdio: ['ignore', conn, 'ignore'] + }).on('close', common.mustCall()); +}).listen(common.PIPE, () => { + const client = net.connect(common.PIPE, common.mustCall()); + client.on('data', () => { + client.end(() => { + server.close(); + }); + }); +}); |