about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDan Gohman <dev@sunfishcode.online>2022-03-02 11:48:50 -0800
committerDan Gohman <dev@sunfishcode.online>2022-03-04 05:09:40 -0800
commit7ddf41c7b10e46c231180cecbbb5e78e0dd12ff8 (patch)
treebb14967f196cd0215cc4a1bcbaa330f21c4993a4
parent7dd32469e5f994cec98969b420e8846d5f4c6c34 (diff)
downloadrust-7ddf41c7b10e46c231180cecbbb5e78e0dd12ff8.tar.gz
rust-7ddf41c7b10e46c231180cecbbb5e78e0dd12ff8.zip
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.
-rw-r--r--library/std/src/sys/windows/process.rs13
1 files changed, 0 insertions, 13 deletions
diff --git a/library/std/src/sys/windows/process.rs b/library/std/src/sys/windows/process.rs
index ec53c46cd7b..fafd1412d4c 100644
--- a/library/std/src/sys/windows/process.rs
+++ b/library/std/src/sys/windows/process.rs
@@ -309,19 +309,6 @@ impl Command {
         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(