Repository navigation
process.stdin is not implemented in bash for Windows 10... unknown type #8839
Description
Activity
- addedchild_processIssues and PRs related to the child_process subsystem.Issues and PRs related to the child_process subsystem.windowsIssues and PRs related to the Windows platform.Issues and PRs related to the Windows platform.processIssues and PRs related to the process subsystem.Issues and PRs related to the process subsystem.
on Sep 28, 2016 - addedlibuvIssues and PRs related to the libuv dependency or the uv binding.Issues and PRs related to the libuv dependency or the uv binding.
on Sep 29, 2016 cc @saghul / @bnoordhuis any idea why this would happen? This is coming from Libuv's file descriptor detection.
- addedchild_processIssues and PRs related to the child_process subsystem.Issues and PRs related to the child_process subsystem.and removedchild_processIssues and PRs related to the child_process subsystem.Issues and PRs related to the child_process subsystem.
on Sep 29, 2016 It's almost certainly a bug in MS's emulation layer. Libuv detects the file type by checking the output of fstat() and getsockname/getsockopt(); Windows probably doesn't implement those with enough fidelity to pass the sniff test.
I'll try to give it a shot during the weekend, but what Ben says sounds about right, fstat is probably lying.
I could reproduce this. The problem is indeed that
tty_wrap.guessHandleTypereturns 'UNKNOWN'. I modified the test case a bit to log.fs.fstatSync(0)and this is what we get:{ dev: 0, mode: 49663, nlink: 1, uid: 0, gid: 0, rdev: 0, blksize: 512, ino: 961, size: 0, blocks: 0, atime: 1970-01-01T00:00:00.000Z, mtime: 1970-01-01T00:00:00.000Z, ctime: 1970-01-01T00:00:00.000Z, birthtime: 1970-01-01T00:00:00.000Z }So, looks like the pipe(2) we internally create to communicate with the child process is not detected as such inside the child itself when doing
fstat.Not sure what we can do here, it's certainly a WSL bug AFAIS.
The mode field looks okay; it's 140777 in octal, indicating it's a socket (same value it has on real Linux) so that probably means
getsockopt(SOL_SOCKET, SO_TYPE)doesn't work. I'm going to guess that it hasn't been implemented or not implemented correctly for UNIX socketpairs, which is what node.js uses to communicate with child processes.Aside, the fact that the dev field is zero is a little suspect and will probably trip up some programs. I'm going to close the issue; @catdad you should take this up with MS.
cc @joshgav, just in case.
- addedwslIssues and PRs related to the Windows Subsystem for Linux.Issues and PRs related to the Windows Subsystem for Linux.
on Jul 22, 2017
uname output, just in case:
Linux WHITSON 3.4.0+ #1 PREEMPT Thu Aug 1 17:06:05 CST 2013 x86_64 x86_64 x86_64Repro code:
I named this file
repro.js... yes, it reads itself, but any stream will reproduce this error.Then run:
node repro.jsThis will output:
This code works correctly (outputting the contents of the file itself) on regular Ubuntu and regular Windows, but not on the Linux subsystem in Windows 10.
This was discovered in catdad/shellton#11.
Same issue happens with
spawnas well, obviously, but it's tougher to get the error.