Skip to content

Commit

Permalink
Unrolled build for rust-lang#118060
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#118060 - ChrisDenton:abs-device-path, r=thomcc

Use an absolute path to the NUL device

While a bare "NUL" *should* be redirected to the NUL device, especially in this simple case, let's be explicit that we aren't opening a file called "NUL" and instead open it directly.

This will also set a good example for people copying std code.

r? libs
  • Loading branch information
rust-timer committed Nov 24, 2023
2 parents 8abf920 + 3a486c1 commit 897e35b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/std/src/sys/windows/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ impl Stdio {
opts.read(stdio_id == c::STD_INPUT_HANDLE);
opts.write(stdio_id != c::STD_INPUT_HANDLE);
opts.security_attributes(&mut sa);
File::open(Path::new("NUL"), &opts).map(|file| file.into_inner())
File::open(Path::new(r"\\.\NUL"), &opts).map(|file| file.into_inner())
}
}
}
Expand Down

0 comments on commit 897e35b

Please sign in to comment.