about summary refs log tree commit diff
path: root/src/libstd/run.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-10-17 21:08:48 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-10-24 14:21:58 -0700
commit620ab3853abf99ecea3a3d055f47cd6d06433c95 (patch)
tree61f35d294ededfa57258fee32e83b54f7f2e0536 /src/libstd/run.rs
parent279c35182050889cba42e4adb1438a7f640fdabd (diff)
downloadrust-620ab3853abf99ecea3a3d055f47cd6d06433c95.tar.gz
rust-620ab3853abf99ecea3a3d055f47cd6d06433c95.zip
Test fixes and merge conflicts
Diffstat (limited to 'src/libstd/run.rs')
-rw-r--r--src/libstd/run.rs17
1 files changed, 3 insertions, 14 deletions
diff --git a/src/libstd/run.rs b/src/libstd/run.rs
index c4cb8be2061..d5f8e82b90f 100644
--- a/src/libstd/run.rs
+++ b/src/libstd/run.rs
@@ -19,6 +19,7 @@ use libc;
 use prelude::*;
 use rt::io::native::process;
 use rt::io;
+use rt::io::extensions::ReaderUtil;
 use task;
 
 /**
@@ -189,18 +190,6 @@ impl Process {
         let output = Cell::new(self.inner.take_output());
         let error = Cell::new(self.inner.take_error());
 
-        fn read_everything(r: &mut io::Reader) -> ~[u8] {
-            let mut ret = ~[];
-            let mut buf = [0, ..1024];
-            loop {
-                match r.read(buf) {
-                    Some(n) => { ret.push_all(buf.slice_to(n)); }
-                    None => break
-                }
-            }
-            return ret;
-        }
-
         // Spawn two entire schedulers to read both stdout and sterr
         // in parallel so we don't deadlock while blocking on one
         // or the other. FIXME (#2625): Surely there's a much more
@@ -210,13 +199,13 @@ impl Process {
         let ch_clone = ch.clone();
         do task::spawn_sched(task::SingleThreaded) {
             match error.take() {
-                Some(ref mut e) => ch.send((2, read_everything(*e))),
+                Some(ref mut e) => ch.send((2, e.read_to_end())),
                 None => ch.send((2, ~[]))
             }
         }
         do task::spawn_sched(task::SingleThreaded) {
             match output.take() {
-                Some(ref mut e) => ch_clone.send((1, read_everything(*e))),
+                Some(ref mut e) => ch_clone.send((1, e.read_to_end())),
                 None => ch_clone.send((1, ~[]))
             }
         }