- Version:
v9.11.1
- Platform:
Windows 10 Pro (64-bit; v10.0.15063)
- Subsystem:
fs module
On Windows, run the following from a cmd.exe console ("Command Prompt"):
:: Echo stdin input
:: OK: Nonempty stdin input.
echo hi | node -pe "require('fs').readFileSync(0).toString()"
:: BREAKS ON WINDOWS: no stdin input, which should *prompt* for it when run in a terminal.
node -pe "require('fs').readFileSync(0).toString()"
:: BREAKS ON WINDOWS: stdin input closed; should return an empty line.
node -pe "require('fs').readFileSync(0).toString()" < NUL
The last 2 commands break as follows:
fs.js:531
binding.fstat(fd);
^
Error: EISDIR: illegal operation on a directory, fstat
at tryStatSync (fs.js:531:13)
at Object.fs.readFileSync (fs.js:567:3)
...
Using .readFile() and the readline module is equally affected.
On Unix platforms, the behavior is as expected in all cases.
v9.11.1Windows 10 Pro (64-bit; v10.0.15063)fsmoduleOn Windows, run the following from a
cmd.execonsole ("Command Prompt"):The last 2 commands break as follows:
Using
.readFile()and thereadlinemodule is equally affected.On Unix platforms, the behavior is as expected in all cases.