-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Inconsistent behavior of stdio[3]: 'ignore'
#52422
Comments
I experienced this when I was examining
|
The error code is different on different OS:
But that might not be a problem? I am guessing retrieving the file descriptor is using a syscall, i.e. translates to different error codes. |
I just did 4 and got an EBADF code @ehmicky ENXIO as detail: Indicates that there is no such device or address |
node/lib/internal/child_process.js Line 489 in 5bae73d
|
Version
v21.7.2
Platform
Linux my-laptop 6.5.0-26-generic #26-Ubuntu SMP PREEMPT_DYNAMIC Tue Mar 5 21:19:28 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
child_process
What steps will reproduce the bug?
With
print.js
:With
example.js
:Prints nothing. But:
Prints the following:
How often does it reproduce? Is there a required condition?
No.
What is the expected behavior? Why is that the expected behavior?
ignore
should behave consistently regardless of the same descriptor.What do you see instead?
ignore
's behavior differs betweenstdio[1]
andstdio[3]
.Additional information
I understand the reason might be that child processes should always have a
stdin
/stdout
/stderr
even when ignored, while this does not apply to other file descriptors. Sostdio[3]: 'ignore'
probably results in no file descriptor being created, as opposed tostdio[1]: 'ignore'
.On one hand, the current behavior is more efficient, as it does not waste creating a file descriptor that's not going to be used.
On the other hand, this results in inconsistent behavior.
Any change there would be breaking too. So this probably won't be fixed, but I reported it in case this was not intentional.
The text was updated successfully, but these errors were encountered: