Skip to content

Commit 7ddf41c

Browse files
committed
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.
1 parent 7dd3246 commit 7ddf41c

File tree

1 file changed

+0
-13
lines changed

1 file changed

+0
-13
lines changed

library/std/src/sys/windows/process.rs

-13
Original file line numberDiff line numberDiff line change
@@ -309,19 +309,6 @@ impl Command {
309309
si.hStdOutput = stdout.as_raw_handle();
310310
si.hStdError = stderr.as_raw_handle();
311311

312-
// `CreateProcessW` fails with `ERROR_FILE_NOT_FOUND` if any of the
313-
// stdio handles are null, so if we have null handles, set them to
314-
// `INVALID_HANDLE_VALUE`.
315-
if si.hStdInput.is_null() {
316-
si.hStdInput = c::INVALID_HANDLE_VALUE;
317-
}
318-
if si.hStdOutput.is_null() {
319-
si.hStdOutput = c::INVALID_HANDLE_VALUE;
320-
}
321-
if si.hStdError.is_null() {
322-
si.hStdError = c::INVALID_HANDLE_VALUE;
323-
}
324-
325312
let program = to_u16s(&program)?;
326313
unsafe {
327314
cvt(c::CreateProcessW(

0 commit comments

Comments
 (0)