mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Rollup merge of #128874 - Kobzol:cmd-verbose-logging, r=onur-ozkan
Disable verbose bootstrap command failure logging by default One of my recent bootstrap command refactoring PRs enabled verbose logging of command failures by default. While this is great for debugging bootstrap, in many situations it's just too verbose and prevents the user from seeing the actual printed stdout/stderr, which usually contains much more useful information. This PR reverts that logic, and only prints a detailed error when `-v` is passed to bootstrap. r? ````@onur-ozkan````
This commit is contained in:
commit
cea3b42f58
@ -986,7 +986,8 @@ impl Build {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Execute a command and return its output.
|
/// Execute a command and return its output.
|
||||||
/// This method should be used for all command executions in bootstrap.
|
/// Note: Ideally, you should use one of the BootstrapCommand::run* functions to
|
||||||
|
/// execute commands. They internally call this method.
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn run(
|
fn run(
|
||||||
&self,
|
&self,
|
||||||
@ -1057,20 +1058,28 @@ Executed at: {executed_at}"#,
|
|||||||
CommandOutput::did_not_start(stdout, stderr)
|
CommandOutput::did_not_start(stdout, stderr)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let fail = |message: &str| {
|
||||||
|
if self.is_verbose() {
|
||||||
|
println!("{message}");
|
||||||
|
} else {
|
||||||
|
println!("Command has failed. Rerun with -v to see more details.");
|
||||||
|
}
|
||||||
|
exit!(1);
|
||||||
|
};
|
||||||
|
|
||||||
if !output.is_success() {
|
if !output.is_success() {
|
||||||
match command.failure_behavior {
|
match command.failure_behavior {
|
||||||
BehaviorOnFailure::DelayFail => {
|
BehaviorOnFailure::DelayFail => {
|
||||||
if self.fail_fast {
|
if self.fail_fast {
|
||||||
println!("{message}");
|
fail(&message);
|
||||||
exit!(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut failures = self.delayed_failures.borrow_mut();
|
let mut failures = self.delayed_failures.borrow_mut();
|
||||||
failures.push(message);
|
failures.push(message);
|
||||||
}
|
}
|
||||||
BehaviorOnFailure::Exit => {
|
BehaviorOnFailure::Exit => {
|
||||||
println!("{message}");
|
fail(&message);
|
||||||
exit!(1);
|
|
||||||
}
|
}
|
||||||
BehaviorOnFailure::Ignore => {
|
BehaviorOnFailure::Ignore => {
|
||||||
// If failures are allowed, either the error has been printed already
|
// If failures are allowed, either the error has been printed already
|
||||||
|
Loading…
Reference in New Issue
Block a user