Files
node/test/parallel/test-child-process-server-close.js
T
Luigi Pinca 67c9f424b8 test: refresh tmpdir in child-process-server-close
PR-URL: https://github.com/nodejs/node/pull/26729
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2019-03-21 09:37:54 +08:00

24 lines
567 B
JavaScript

'use strict';
const common = require('../common');
const { spawn } = require('child_process');
const net = require('net');
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());
}).listen(common.PIPE, () => {
const client = net.connect(common.PIPE, common.mustCall());
client.on('data', () => {
client.end(() => {
server.close();
});
});
});