about summary refs log tree commit diff
path: root/src/libstd/sys
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-01-26 13:26:08 +0000
committerbors <bors@rust-lang.org>2016-01-26 13:26:08 +0000
commit5d6e8fcedac1184a28031ee0cf63e2d862e4536f (patch)
tree73ca828212a1d995b4cab760b207964f9c6e8231 /src/libstd/sys
parent43c1a173a874f5513db58b2f5321489a00087484 (diff)
parentb6faae11f46b18221555759d3e6fad12cbd0ee97 (diff)
downloadrust-5d6e8fcedac1184a28031ee0cf63e2d862e4536f.tar.gz
rust-5d6e8fcedac1184a28031ee0cf63e2d862e4536f.zip
Auto merge of #31214 - Manishearth:rollup, r=Manishearth
- Successful merges: #31172, #31177, #31211
- Failed merges:
Diffstat (limited to 'src/libstd/sys')
-rw-r--r--src/libstd/sys/windows/process.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/libstd/sys/windows/process.rs b/src/libstd/sys/windows/process.rs
index e0f8d6f9df9..61f73b00265 100644
--- a/src/libstd/sys/windows/process.rs
+++ b/src/libstd/sys/windows/process.rs
@@ -351,10 +351,15 @@ fn make_dirp(d: Option<&OsString>) -> (*const u16, Vec<u16>) {
 impl Stdio {
     fn to_handle(&self, stdio_id: c::DWORD) -> io::Result<Handle> {
         match *self {
+            // If no stdio handle is available, then inherit means that it
+            // should still be unavailable so propagate the
+            // INVALID_HANDLE_VALUE.
             Stdio::Inherit => {
-                stdio::get(stdio_id).and_then(|io| {
-                    io.handle().duplicate(0, true, c::DUPLICATE_SAME_ACCESS)
-                })
+                match stdio::get(stdio_id) {
+                    Ok(io) => io.handle().duplicate(0, true,
+                                                    c::DUPLICATE_SAME_ACCESS),
+                    Err(..) => Ok(Handle::new(c::INVALID_HANDLE_VALUE)),
+                }
             }
             Stdio::Raw(handle) => {
                 RawHandle::new(handle).duplicate(0, true, c::DUPLICATE_SAME_ACCESS)