diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-03-13 22:27:12 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-03-23 07:22:48 -0700 |
| commit | 5ca8a735ca36219abbf601624606c41148b95210 (patch) | |
| tree | 123992e3bb3d2051064c51478244dbdc072de7e8 /src/libstd/sys/windows/process.rs | |
| parent | 90346eae18e83887517e096c17678a74838ff995 (diff) | |
| download | rust-5ca8a735ca36219abbf601624606c41148b95210.tar.gz rust-5ca8a735ca36219abbf601624606c41148b95210.zip | |
std: Don't cache stdio handles on Windows
This alters the stdio code on Windows to always call `GetStdHandle` whenever the stdio read/write functions are called as this allows us to track changes to the value over time (such as if a process calls `SetStdHandle` while it's running). Closes #40490
Diffstat (limited to 'src/libstd/sys/windows/process.rs')
| -rw-r--r-- | src/libstd/sys/windows/process.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs index 1afb3728c9d..dfbc1b581ee 100644 --- a/src/libstd/sys/windows/process.rs +++ b/src/libstd/sys/windows/process.rs @@ -257,8 +257,13 @@ impl Stdio { // INVALID_HANDLE_VALUE. Stdio::Inherit => { match stdio::get(stdio_id) { - Ok(io) => io.handle().duplicate(0, true, - c::DUPLICATE_SAME_ACCESS), + Ok(io) => { + let io = Handle::new(io.handle()); + let ret = io.duplicate(0, true, + c::DUPLICATE_SAME_ACCESS); + io.into_raw(); + return ret + } Err(..) => Ok(Handle::new(c::INVALID_HANDLE_VALUE)), } } |
