Merge "Don't print output on the binder thread"
diff --git a/vm/src/run.rs b/vm/src/run.rs
index 05a9390..058405e 100644
--- a/vm/src/run.rs
+++ b/vm/src/run.rs
@@ -253,15 +253,15 @@
fn on_payload_started(&self, _cid: i32, stream: Option<&File>) {
// Show the output of the payload
if let Some(stream) = stream {
- let mut reader = BufReader::new(stream);
- loop {
+ let mut reader = BufReader::new(stream.try_clone().unwrap());
+ std::thread::spawn(move || loop {
let mut s = String::new();
match reader.read_line(&mut s) {
Ok(0) => break,
Ok(_) => print!("{}", s),
Err(e) => eprintln!("error reading from virtual machine: {}", e),
};
- }
+ });
}
}