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
This commit is contained in:
commit
b2d6480f53
@ -597,7 +597,7 @@ fn to_handle(&self, stdio_id: c::DWORD, pipe: &mut Option<AnonPipe>) -> io::Resu
|
||||
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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user