Skip to content

If a command fails but does not have stderr/stdout, bootstrap shows no context for what failed #145002

Description

@jieyouxu

E.g. #144995 (comment)

If we have neither command stdout nor stderr, then

fn fail(&self, message: &str, output: CommandOutput) -> ! {
if self.is_verbose() {
println!("{message}");
} else {
let (stdout, stderr) = (output.stdout_if_present(), output.stderr_if_present());
// If the command captures output, the user would not see any indication that
// it has failed. In this case, print a more verbose error, since to provide more
// context.
if stdout.is_some() || stderr.is_some() {
if let Some(stdout) = output.stdout_if_present().take_if(|s| !s.trim().is_empty()) {
println!("STDOUT:\n{stdout}\n");
}
if let Some(stderr) = output.stderr_if_present().take_if(|s| !s.trim().is_empty()) {
println!("STDERR:\n{stderr}\n");
}
println!("Command has failed. Rerun with -v to see more details.");
} else {
println!("Command has failed. Rerun with -v to see more details.");
}
}
exit!(1);
}

we only get the message

Command has failed. Rerun with -v to see more details.

which especially in CI, there's no indication as to what actually failed.

cc @Shourya742 (in case you're interested)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions