Skip to content

Commit 6c5c2d5

Browse files
authored
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
2 parents befcea3 + ff4b636 commit 6c5c2d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

std/src/sys/windows/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ impl Stdio {
597597
opts.read(stdio_id == c::STD_INPUT_HANDLE);
598598
opts.write(stdio_id != c::STD_INPUT_HANDLE);
599599
opts.security_attributes(&mut sa);
600-
File::open(Path::new("NUL"), &opts).map(|file| file.into_inner())
600+
File::open(Path::new(r"\\.\NUL"), &opts).map(|file| file.into_inner())
601601
}
602602
}
603603
}

0 commit comments

Comments
 (0)