Open
Description
Currently, if this happens:
use std::process::Command;
...
Command::new("child.exe")
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null())
.spawn()
the child.exe
accidentally inherits stdin, stdout and stderr handles of the parent process. This can be bad, because the objects these handles point to (say pipes), may be watched by some third process.
Since at the point of creating a child process we know that it does not need our std handles (because it's explicitly being created with Stdio::null()
), we can temporarily disable handle inheritance on these handles.