diff options
| author | Chris Denton <chris@chrisdenton.dev> | 2023-11-19 16:24:39 +0000 |
|---|---|---|
| committer | Chris Denton <chris@chrisdenton.dev> | 2023-11-19 16:24:39 +0000 |
| commit | 3a486c1feb0a4846a3bcff0dda5182dc9c762ba2 (patch) | |
| tree | a2535a6bd4fe5ffa999850d2f70c96bc8d4b8502 /library/std/src/sys/windows/process.rs | |
| parent | 097261f241d0295a84a1fc754639e58202ea7e8e (diff) | |
| download | rust-3a486c1feb0a4846a3bcff0dda5182dc9c762ba2.tar.gz rust-3a486c1feb0a4846a3bcff0dda5182dc9c762ba2.zip | |
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.
Diffstat (limited to 'library/std/src/sys/windows/process.rs')
| -rw-r--r-- | library/std/src/sys/windows/process.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/sys/windows/process.rs b/library/std/src/sys/windows/process.rs index f4078d35944..3b22f6d2e31 100644 --- a/library/std/src/sys/windows/process.rs +++ b/library/std/src/sys/windows/process.rs @@ -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()) } } } |
