-
Notifications
You must be signed in to change notification settings - Fork 13.4k
std::io::process::StdioContainer::Ignored doesn't attach streams to /dev/null with libnative #14456
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
Comments
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
May 28, 2014
When spawning a process, stdio file descriptors can be configured to be ignored, which basically means that they'll be closed. Currently this is done by literally closing the file descriptors in the child, but this can have adverse side effects if the child process then opens a new file descriptor, assigning it to a stdio number. To work around the problems of the child, this commit alters the process spawning code to map stdio fds to /dev/null on unix (and a similar equivalent on windows) when they are specified as being ignored. This should allow spawned programs to have more expected behavior when opening new files. Closes rust-lang#14456
bors
added a commit
that referenced
this issue
May 29, 2014
When spawning a process, stdio file descriptors can be configured to be ignored, which basically means that they'll be closed. Currently this is done by literally closing the file descriptors in the child, but this can have adverse side effects if the child process then opens a new file descriptor, assigning it to a stdio number. To work around the problems of the child, this commit alters the process spawning code to map stdio fds to /dev/null on unix (and a similar equivalent on windows) when they are specified as being ignored. This should allow spawned programs to have more expected behavior when opening new files. Closes #14456
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jun 5, 2023
Use async block in async fn type inference fix rust-lang#14456 At some point we should probably go further and completely desugar async fn in hir lowering.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider the following program:
The output with libnative is:
IOW, stdin and stderr weren't attached to /dev/null in the subprocess, and whatever open the subprocess did took fd 0, which, in the case of ls, ends up being assigned by opendir() to the directory being listed. Fun failures could follow with processes that use stdin/stdout/stderr.
With rustuv, it looks like the expected result:
The text was updated successfully, but these errors were encountered: