Skip to content

Commit 385e243

Browse files
committed
Auto merge of #3590 - dgellow:fix-3536, r=alexcrichton
When an error occured in a JobQueue print it directly Fix #3536
2 parents b1c8afe + a8a944c commit 385e243

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/cargo/lib.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub fn process_executed<T>(result: CliResult<Option<T>>, shell: &mut MultiShell)
9696
where T: Encodable
9797
{
9898
match result {
99-
Err(e) => handle_error(e, shell),
99+
Err(e) => handle_cli_error(e, shell),
100100
Ok(Some(encodable)) => {
101101
let encoded = json::encode(&encodable).unwrap();
102102
println!("{}", encoded);
@@ -150,8 +150,8 @@ pub fn shell(verbosity: Verbosity, color_config: ColorConfig) -> MultiShell {
150150
}
151151
}
152152

153-
pub fn handle_error(err: CliError, shell: &mut MultiShell) {
154-
debug!("handle_error; err={:?}", err);
153+
pub fn handle_cli_error(err: CliError, shell: &mut MultiShell) {
154+
debug!("handle_cli_error; err={:?}", err);
155155

156156
let CliError { error, exit_code, unknown } = err;
157157
// exit_code == 0 is non-fatal error, e.g. docopt version info
@@ -177,6 +177,13 @@ pub fn handle_error(err: CliError, shell: &mut MultiShell) {
177177
std::process::exit(exit_code);
178178
}
179179

180+
pub fn handle_error(err: &CargoError, shell: &mut MultiShell) {
181+
debug!("handle_error; err={:?}", err);
182+
183+
let _ignored_result = shell.error(err);
184+
handle_cause(err, shell);
185+
}
186+
180187
fn handle_cause(mut cargo_err: &CargoError, shell: &mut MultiShell) -> bool {
181188
let verbose = shell.get_verbose();
182189
let mut err;

src/cargo/ops/cargo_rustc/job_queue.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use term::color::YELLOW;
99

1010
use core::{PackageId, Target, Profile};
1111
use util::{Config, DependencyQueue, Fresh, Dirty, Freshness};
12-
use util::{CargoResult, ProcessBuilder, profile, internal};
12+
use util::{CargoResult, ProcessBuilder, profile, internal, human};
13+
use {handle_error};
1314

1415
use super::{Context, Kind, Unit};
1516
use super::job::Job;
@@ -182,6 +183,8 @@ impl<'a> JobQueue<'a> {
182183
Ok(()) => self.finish(key, cx)?,
183184
Err(e) => {
184185
if self.active > 0 {
186+
error = Some(human("build failed"));
187+
handle_error(&*e, &mut *cx.config.shell());
185188
cx.config.shell().say(
186189
"Build failed, waiting for other \
187190
jobs to finish...", YELLOW)?;

0 commit comments

Comments
 (0)