node/test/parallel/test-child-process-stdout-ipc.js
Nikolai Vavilov 403ccb68a5 lib: setup IPC channel before console
Initializing IOCP on the same fd twice can fail on Windows.
Consequently, if the IPC channel uses fd 1 or 2 and the console is setup
first, writing to the IPC channel will fail.

PR-URL: https://github.com/nodejs/node/pull/16562
Fixes: https://github.com/nodejs/node/issues/16141
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
2017-10-29 20:59:24 +02:00

19 lines
397 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const spawn = require('child_process').spawn;
if (process.argv[2] === 'child') {
process.send('hahah');
return;
}
const proc = spawn(process.execPath, [__filename, 'child'], {
stdio: ['inherit', 'ipc', 'inherit']
});
proc.on('exit', common.mustCall(function(code) {
assert.strictEqual(code, 0);
}));