mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 09:27:27 +00:00
ra_cargo_watch: log more errors
This commit is contained in:
parent
fdb12f3e0e
commit
59ba386bee
1 changed files with 16 additions and 3 deletions
|
@ -259,7 +259,7 @@ pub fn run_cargo(
|
|||
let mut child = command
|
||||
.args(args)
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::null())
|
||||
.stderr(Stdio::piped())
|
||||
.stdin(Stdio::null())
|
||||
.spawn()
|
||||
.expect("couldn't launch cargo");
|
||||
|
@ -352,8 +352,21 @@ impl WatchThread {
|
|||
// It is okay to ignore the result, as it only errors if the process is already dead
|
||||
let _ = child.kill();
|
||||
|
||||
// Again, we don't care about the exit status so just ignore the result
|
||||
let _ = child.wait();
|
||||
// Again, we are resilient to errors, so we don't try to panic here
|
||||
match child.wait_with_output() {
|
||||
Ok(output) => match output.status.code() {
|
||||
Some(0) | None => {}
|
||||
Some(exit_code) => {
|
||||
let output =
|
||||
std::str::from_utf8(&output.stderr).unwrap_or("<bad utf8 output>");
|
||||
|
||||
if !output.contains("could not compile") {
|
||||
log::error!("Cargo failed with exit code {} {}", exit_code, output);
|
||||
}
|
||||
}
|
||||
},
|
||||
Err(err) => log::error!("Cargo io error: {:?}", err),
|
||||
}
|
||||
}))
|
||||
} else {
|
||||
None
|
||||
|
|
Loading…
Reference in a new issue