-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stdio regression: process.stdin getter drops pending stdin data #36251
Comments
able to recreate with the said version, but not consistently.
so I believe there is a race condition happening here. |
@gireeshpunathil Yes there is. The |
@mmomtchev - thanks, I too got a linux box which recreates pretty easily. passing case: [pid 661072] execve("/bin/bash", ["/bin/bash"], 0x55dd87501770 /* 22 vars */ <unfinished ...>
...
[pid 661072] read(0, "#!/bin/bash\necho \"hello from nod"..., 49) = 49
[pid 661072] fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(0x88, 0), ...}) = 0
[pid 661072] write(1, "hello from node's child shell\n", 30) = 30
[pid 661072] read(0, "", 49) = 0
[pid 661072] rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
[pid 661072] rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
[pid 661072] exit_group(0) = ? the process failing case: 489 [pid 661087] execve("/bin/bash", ["/bin/bash"], 0x557edd43a770 /* 22 vars */ <unfinished ...>
...
615 [pid 661088] <... read resumed>"#!/bin/bash\necho \"hello from nod"..., 65536) = 49
..
701 [pid 661087] read(0, "", 49) = 0
702 [pid 661087] rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
703 [pid 661087] rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
704 [pid 661087] exit_group(0) = ? The process |
@gireeshpunathil @isaacs I solved it by implementing a |
@gireeshpunathil All other stdio |
@isaacs @gireeshpunathil This will be a platform-dependent unit test, exclusive to |
All stdio ReadStream's use manual start to avoid consuming data for example when a process execs/spawns Refs: nodejs#36251
The unit test is awful, I admit, if you have any ideas, fell free to comment |
All stdio ReadStream's use manual start to avoid consuming data for example when a process execs/spawns Refs: nodejs#36251
All stdio ReadStream's use manual start to avoid consuming data for example when a process execs/spawns. Using stream._construct would cause the Readable to incorrectly greedily start reading. Refs: nodejs#36251
What steps will reproduce the bug?
In v15, if
process.stdin
is referenced, and is not a TTY or Pipe, then its data will be not be seen when passed to a child process. It's almost like it's already consumed or something.How often does it reproduce? Is there a required condition?
100% of the time on node 15. Not in any prior version tested (14, 12, and 10).
What is the expected behavior?
Stdin data should not be consumed when
process.stdin
is merely referenced. This causes problems when a script checksprocess.stdin.isTTY
to print a helpful message prior to opening a shell in a child process.What do you see instead?
Stdin data is not passed to child process if stdin is referenced, and not a Pipe or TTY.
Additional information
This kind of is a pain for
npm exec
. It means you can't do something likenpx some-interactive-thing < list-of-commands
.The text was updated successfully, but these errors were encountered: