This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
--use-legacy and process redirection are broken on Windows #1844
Closed
Description
In nodejs 0.5.8 (Windows 32-bit build), the following immediately crashes:
> nodejs-versions\nodejs-0.5.8\node.exe --use-legacy -e console.log('OK')
node.js:238
stdout._handle.unref();
^
TypeError: Cannot call method 'unref' of undefined
at EventEmitter.stdout (node.js:238:26)
at Object.<anonymous> (console.js:26:10)
at Object.<anonymous> (eval at <anonymous> (eval:1:75))
at Object.<anonymous> (eval:1:63)
at Module._compile (module.js:432:26)
at startup (node.js:96:14)
at node.js:559:3
In version 0.5.7, the command worked as expected:
> nodejs-versions\nodejs-0.5.7\node.exe --use-legacy -e console.log('OK')
OK
It seems as if STDIO is broken on Windows. This is problematic as it seems that nodejs also uses this "legacy" mode when it is launched from within another program with its standard IO redirected to other file handles. This works with 0.5.7:
>nodejs-versions\nodejs-0.5.7\node.exe -e console.log('OK') |perl -ple "s!$! piped to $^X!"
OK piped to C:\strawberry\perl\bin\perl.exe
... but fails fatally with 0.5.8, without any recourse to launch nodejs as subprocess and receive data from it:
>nodejs-versions\nodejs-0.5.8\node.exe -e console.log('OK') |perl -ple "s!$! piped to $^X!"
node.js:207
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: write EINVAL
at errnoException (net_uv.js:566:11)
at Socket.write (net_uv.js:389:18)
at Object.<anonymous> (console.js:26:18)
at Object.<anonymous> (eval at <anonymous> (eval:1:75))
at Object.<anonymous> (eval:1:63)
at Module._compile (module.js:432:26)
at startup (node.js:96:14)
at node.js:559:3
Activity