Skip to content

Commit 314e25b

Browse files
committed
update execution_context and replace builder with execution_context in all the run methods
1 parent 6282474 commit 314e25b

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/bootstrap/src/utils/exec.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(warnings)]
12
//! Command Execution Module
23
//!
34
//! This module provides a structured way to execute and manage commands efficiently,
@@ -11,7 +12,7 @@ use std::process::{Command, CommandArgs, CommandEnvs, ExitStatus, Output, Stdio}
1112
use build_helper::ci::CiEnv;
1213
use build_helper::drop_bomb::DropBomb;
1314

14-
use crate::Build;
15+
use super::execution_context::ExecutionContext;
1516

1617
/// What should be done when the command fails.
1718
#[derive(Debug, Copy, Clone)]
@@ -143,20 +144,20 @@ impl BootstrapCommand {
143144
/// Run the command, while printing stdout and stderr.
144145
/// Returns true if the command has succeeded.
145146
#[track_caller]
146-
pub fn run(&mut self, builder: &Build) -> bool {
147-
builder.run(self, OutputMode::Print, OutputMode::Print).is_success()
147+
pub fn run(&mut self, execution_context: &ExecutionContext) -> bool {
148+
execution_context.run(self, OutputMode::Print, OutputMode::Print).is_success()
148149
}
149150

150151
/// Run the command, while capturing and returning all its output.
151152
#[track_caller]
152-
pub fn run_capture(&mut self, builder: &Build) -> CommandOutput {
153-
builder.run(self, OutputMode::Capture, OutputMode::Capture)
153+
pub fn run_capture(&mut self, execution_context: &ExecutionContext) -> CommandOutput {
154+
execution_context.run(self, OutputMode::Capture, OutputMode::Capture)
154155
}
155156

156157
/// Run the command, while capturing and returning stdout, and printing stderr.
157158
#[track_caller]
158-
pub fn run_capture_stdout(&mut self, builder: &Build) -> CommandOutput {
159-
builder.run(self, OutputMode::Capture, OutputMode::Print)
159+
pub fn run_capture_stdout(&mut self, execution_context: &ExecutionContext) -> CommandOutput {
160+
execution_context.run(self, OutputMode::Capture, OutputMode::Print)
160161
}
161162

162163
/// Provides access to the stdlib Command inside.

src/bootstrap/src/utils/execution_context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
use std::sync::{Arc, Mutex};
33

44
use crate::core::config::DryRun;
5-
use crate::{BehaviorOnFailure, BootstrapCommand, CommandOutput, OutputMode, RefCell, exit};
5+
use crate::{BehaviorOnFailure, BootstrapCommand, CommandOutput, OutputMode, exit};
66

7-
#[derive(Clone)]
7+
#[derive(Clone, Default)]
88
pub struct ExecutionContext {
99
dry_run: DryRun,
1010
verbose: u8,

0 commit comments

Comments
 (0)