Remove redundant code for handling NULL handles on Windows.

Before calling `CreateProcessW`, stdio handles are passed through
`stdio::get_handle`, which already converts NULL to
`INVALID_HANDLE_VALUE`, so we don't need extra checks for NULL after
that point.
This commit is contained in:
Dan Gohman 2022-03-02 11:48:50 -08:00
parent 7dd32469e5
commit 7ddf41c7b1

View File

@ -309,19 +309,6 @@ pub fn spawn(
si.hStdOutput = stdout.as_raw_handle();
si.hStdError = stderr.as_raw_handle();
// `CreateProcessW` fails with `ERROR_FILE_NOT_FOUND` if any of the
// stdio handles are null, so if we have null handles, set them to
// `INVALID_HANDLE_VALUE`.
if si.hStdInput.is_null() {
si.hStdInput = c::INVALID_HANDLE_VALUE;
}
if si.hStdOutput.is_null() {
si.hStdOutput = c::INVALID_HANDLE_VALUE;
}
if si.hStdError.is_null() {
si.hStdError = c::INVALID_HANDLE_VALUE;
}
let program = to_u16s(&program)?;
unsafe {
cvt(c::CreateProcessW(