about summary refs log tree commit diff
path: root/src/libstd/sys/unix/process.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/sys/unix/process.rs')
-rw-r--r--src/libstd/sys/unix/process.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/libstd/sys/unix/process.rs b/src/libstd/sys/unix/process.rs
index 62a1799de94..d5469eb82ef 100644
--- a/src/libstd/sys/unix/process.rs
+++ b/src/libstd/sys/unix/process.rs
@@ -17,7 +17,7 @@ use collections::HashMap;
 use ffi::CString;
 use hash::Hash;
 use old_io::process::{ProcessExit, ExitStatus, ExitSignal};
-use old_io::{self, IoResult, IoError, EndOfFile};
+use old_io::{IoResult, EndOfFile};
 use libc::{self, pid_t, c_void, c_int};
 use mem;
 use os;
@@ -33,12 +33,6 @@ pub use sys_common::ProcessConfig;
 
 helper_init! { static HELPER: Helper<Req> }
 
-/// Unix-specific extensions to the Command builder
-pub struct CommandExt {
-    uid: Option<u32>,
-    gid: Option<u32>,
-}
-
 /// The unique id of the process (this should never be negative).
 pub struct Process {
     pub pid: pid_t
@@ -332,7 +326,7 @@ impl Process {
         // The actual communication between the helper thread and this thread is
         // quite simple, just a channel moving data around.
 
-        unsafe { HELPER.boot(register_sigchld, waitpid_helper) }
+        HELPER.boot(register_sigchld, waitpid_helper);
 
         match self.try_wait() {
             Some(ret) => return Ok(ret),
@@ -340,7 +334,7 @@ impl Process {
         }
 
         let (tx, rx) = channel();
-        unsafe { HELPER.send(NewChild(self.pid, tx, deadline)); }
+        HELPER.send(NewChild(self.pid, tx, deadline));
         return match rx.recv() {
             Ok(e) => Ok(e),
             Err(..) => Err(timeout("wait timed out")),
@@ -424,8 +418,15 @@ impl Process {
                             Ok(NewChild(pid, tx, deadline)) => {
                                 active.push((pid, tx, deadline));
                             }
+                            // Once we've been disconnected it means the main
+                            // thread is exiting (at_exit has run). We could
+                            // still have active waiter for other threads, so
+                            // we're just going to drop them all on the floor.
+                            // This means that they won't receive a "you're
+                            // done" message in which case they'll be considered
+                            // as timed out, but more generally errors will
+                            // start propagating.
                             Err(TryRecvError::Disconnected) => {
-                                assert!(active.len() == 0);
                                 break 'outer;
                             }
                             Err(TryRecvError::Empty) => break,