From a7931eabcd1762917f1465dce4a2bb1b7cbd07eb Mon Sep 17 00:00:00 2001 From: Toru Ogawa Date: Thu, 24 Jan 2019 00:48:37 +0900 Subject: [PATCH] read stdout before wait --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 1ac1e0ff..65efde82 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1584,6 +1584,8 @@ fn cargo_target_by_message(input: &Input, manifest: &str, use_bincache: bool, me trace!(".. cmd: {:?}", cmd); let mut child = try!(cmd.spawn()); + let mut stdout = Vec::new(); + try!(child.stdout.take().unwrap().read_to_end(&mut stdout)); match try!(child.wait()).code() { Some(0) => (), Some(st) => return Err(format!("could not determine target filename: cargo exited with status {}", st).into()), @@ -1591,7 +1593,7 @@ fn cargo_target_by_message(input: &Input, manifest: &str, use_bincache: bool, me } let mut line = String::with_capacity(1024); - let mut stdout = BufReader::new(child.stdout.take().unwrap()); + let mut stdout = BufReader::new(std::io::Cursor::new(stdout)); let null = json::Json::Null; let package_name = input.package_name();