Skip to content

Commit bf8c101

Browse files
committed
add should cache to bootstrap command
1 parent abbc560 commit bf8c101

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/bootstrap/src/utils/exec.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ pub struct BootstrapCommand {
8181
args: Vec<OsString>,
8282
envs: Vec<(OsString, OsString)>,
8383
cwd: Option<PathBuf>,
84+
should_cache: bool,
8485

8586
command: Command,
8687
pub failure_behavior: BehaviorOnFailure,
@@ -94,15 +95,18 @@ pub struct BootstrapCommand {
9495
impl<'a> BootstrapCommand {
9596
#[track_caller]
9697
pub fn new<S: AsRef<OsStr>>(program: S) -> Self {
97-
Command::new(program).into()
98+
Self { should_cache: true, ..Command::new(program).into() }
9899
}
99-
100100
pub fn arg<S: AsRef<OsStr>>(&mut self, arg: S) -> &mut Self {
101101
self.args.push(arg.as_ref().to_os_string());
102102
self.command.arg(arg.as_ref());
103103
self
104104
}
105105

106+
pub fn should_cache(&self) -> bool {
107+
self.should_cache
108+
}
109+
106110
pub fn args<I, S>(&mut self, args: I) -> &mut Self
107111
where
108112
I: IntoIterator<Item = S>,
@@ -205,6 +209,7 @@ impl<'a> BootstrapCommand {
205209
// We don't know what will happen with the returned command, so we need to mark this
206210
// command as executed proactively.
207211
self.mark_as_executed();
212+
self.should_cache = false;
208213
&mut self.command
209214
}
210215

@@ -258,6 +263,7 @@ impl From<Command> for BootstrapCommand {
258263
args: Vec::new(),
259264
envs: Vec::new(),
260265
cwd: None,
266+
should_cache: false,
261267
command,
262268
failure_behavior: BehaviorOnFailure::Exit,
263269
run_always: false,

0 commit comments

Comments
 (0)