Skip to content

Commit 5291c9f

Browse files
committed
add do_not_cache method and update the warning on as_command_mut
1 parent 08d7b29 commit 5291c9f

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/bootstrap/src/utils/exec.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ impl<'a> BootstrapCommand {
101101
self.should_cache
102102
}
103103

104+
pub fn cache_never(&mut self) -> &mut Self {
105+
self.should_cache = false;
106+
self
107+
}
108+
104109
pub fn args<I, S>(&mut self, args: I) -> &mut Self
105110
where
106111
I: IntoIterator<Item = S>,
@@ -203,10 +208,11 @@ impl<'a> BootstrapCommand {
203208
/// Provides access to the stdlib Command inside.
204209
/// FIXME: This function should be eventually removed from bootstrap.
205210
pub fn as_command_mut(&mut self) -> &mut Command {
206-
// We don't know what will happen with the returned command, so we need to mark this
207-
// command as executed proactively.
211+
// We proactively mark this command as executed since we can't be certain how the returned
212+
// command will be handled. Caching must also be avoided here, as the inner command could be
213+
// modified externally without us being aware.
208214
self.mark_as_executed();
209-
self.should_cache = false;
215+
self.cache_never();
210216
&mut self.command
211217
}
212218

0 commit comments

Comments
 (0)