aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorveetaha <[email protected]>2020-03-18 20:49:14 +0000
committerveetaha <[email protected]>2020-03-21 21:36:31 +0000
commit59ba386bee974b56b546eb7e8fdec6721ab0d08a (patch)
tree047550163eb5b06092586afdef5ceac158d0a9d0
parentfdb12f3e0ecf827d10f81ba4dd0824a3bdce1c97 (diff)
ra_cargo_watch: log more errors
-rw-r--r--crates/ra_cargo_watch/src/lib.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/crates/ra_cargo_watch/src/lib.rs b/crates/ra_cargo_watch/src/lib.rs
index bffe5eb00..deb763af9 100644
--- a/crates/ra_cargo_watch/src/lib.rs
+++ b/crates/ra_cargo_watch/src/lib.rs
@@ -259,7 +259,7 @@ pub fn run_cargo(
259 let mut child = command 259 let mut child = command
260 .args(args) 260 .args(args)
261 .stdout(Stdio::piped()) 261 .stdout(Stdio::piped())
262 .stderr(Stdio::null()) 262 .stderr(Stdio::piped())
263 .stdin(Stdio::null()) 263 .stdin(Stdio::null())
264 .spawn() 264 .spawn()
265 .expect("couldn't launch cargo"); 265 .expect("couldn't launch cargo");
@@ -352,8 +352,21 @@ impl WatchThread {
352 // It is okay to ignore the result, as it only errors if the process is already dead 352 // It is okay to ignore the result, as it only errors if the process is already dead
353 let _ = child.kill(); 353 let _ = child.kill();
354 354
355 // Again, we don't care about the exit status so just ignore the result 355 // Again, we are resilient to errors, so we don't try to panic here
356 let _ = child.wait(); 356 match child.wait_with_output() {
357 Ok(output) => match output.status.code() {
358 Some(0) | None => {}
359 Some(exit_code) => {
360 let output =
361 std::str::from_utf8(&output.stderr).unwrap_or("<bad utf8 output>");
362
363 if !output.contains("could not compile") {
364 log::error!("Cargo failed with exit code {} {}", exit_code, output);
365 }
366 }
367 },
368 Err(err) => log::error!("Cargo io error: {:?}", err),
369 }
357 })) 370 }))
358 } else { 371 } else {
359 None 372 None