mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
21 lines
504 B
JavaScript
21 lines
504 B
JavaScript
|
'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();
|
||
|
});
|
||
|
});
|
||
|
});
|