Skip to content

Commit b2d6480

Browse files
authored
Rollup merge of #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 c3216e2 + 3a486c1 commit b2d6480

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

+1-1
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)