Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #103459 - ChrisDenton:propagate-nulls, r=thomcc
Pass on null handle values to child process Fixes #101645 In Windows, stdio handles are (semantically speaking) `Option<Handle>` where `Handle` is a non-zero value. When spawning a process with `Stdio::Inherit`, Rust currently turns zero values into `-1` values. This has the unfortunate effect of breaking console subprocesses (which typically need stdio) that are spawned from gui applications (that lack stdio by default) because the console process won't be assigned handles from the newly created console (as they usually would in that situation). Worse, `-1` is actually [a valid handle](https://doc.rust-lang.org/std/os/windows/io/struct.OwnedHandle.html) which means "the current process". So if a console process, for example, waits on stdin and it has a `-1` value then the process will end up waiting on itself. This PR fixes it by propagating the nulls instead of converting them to `-1`. While I think the current behaviour is a mistake, changing it (however justified) is an API change so I think this PR should at least have some input from t-libs-api. So choosing at random... r? `@joshtriplett`
- Loading branch information