restructure try_run_tests

This commit is contained in:
bit-aloo 2025-07-04 20:54:09 +05:30
parent 8199c950e8
commit 312de35d3a
No known key found for this signature in database
2 changed files with 13 additions and 18 deletions

View file

@ -223,7 +223,7 @@ impl<'a> BootstrapCommand {
/// Mark the command as being executed, disarming the drop bomb.
/// If this method is not called before the command is dropped, its drop will panic.
fn mark_as_executed(&mut self) {
pub fn mark_as_executed(&mut self) {
self.drop_bomb.defuse();
}
@ -625,18 +625,12 @@ impl ExecutionContext {
exit!(1);
}
<<<<<<< HEAD
pub fn stream<'a>(
=======
/// Spawns the command with configured stdout and stderr handling.
///
/// Returns `None` if in dry-run mode and the command is not allowed to run.
///
/// Panics if the command fails to spawn.
/// Returns None if in dry-run mode or Panics if the command fails to spawn.
pub fn stream(
>>>>>>> c2e83361cec (add comment to exec)
&self,
command: &'a mut BootstrapCommand,
command: &mut BootstrapCommand,
stdout: OutputMode,
stderr: OutputMode,
) -> Option<StreamingCommand> {

View file

@ -34,16 +34,17 @@ pub(crate) fn try_run_tests(
cmd: &mut BootstrapCommand,
stream: bool,
) -> bool {
if !run_tests(builder, cmd, stream) {
if builder.fail_fast {
crate::exit!(1);
} else {
builder.config.exec_ctx().add_to_delay_failure(format!("{cmd:?}"));
false
}
} else {
true
if run_tests(builder, cmd, stream) {
return true;
}
if builder.fail_fast {
crate::exit!(1);
}
builder.config.exec_ctx().add_to_delay_failure(format!("{cmd:?}"));
false
}
fn run_tests(builder: &Builder<'_>, cmd: &mut BootstrapCommand, stream: bool) -> bool {