about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbit-aloo <sshourya17@gmail.com>2025-06-24 19:56:31 +0530
committerbit-aloo <sshourya17@gmail.com>2025-06-27 10:38:07 +0530
commit5291c9fcec04436d08fd5689202ff574fd813488 (patch)
tree00015e3e815109c49de01a4afac9d31bb063a52f /src
parent08d7b297194502bd92a6e2bb536e50a175cf202f (diff)
downloadrust-5291c9fcec04436d08fd5689202ff574fd813488.tar.gz
rust-5291c9fcec04436d08fd5689202ff574fd813488.zip
add do_not_cache method and update the warning on as_command_mut
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/utils/exec.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/bootstrap/src/utils/exec.rs b/src/bootstrap/src/utils/exec.rs
index 7b3ae3c9f75..142afec85a6 100644
--- a/src/bootstrap/src/utils/exec.rs
+++ b/src/bootstrap/src/utils/exec.rs
@@ -101,6 +101,11 @@ impl<'a> BootstrapCommand {
         self.should_cache
     }
 
+    pub fn cache_never(&mut self) -> &mut Self {
+        self.should_cache = false;
+        self
+    }
+
     pub fn args<I, S>(&mut self, args: I) -> &mut Self
     where
         I: IntoIterator<Item = S>,
@@ -203,10 +208,11 @@ impl<'a> BootstrapCommand {
     /// Provides access to the stdlib Command inside.
     /// FIXME: This function should be eventually removed from bootstrap.
     pub fn as_command_mut(&mut self) -> &mut Command {
-        // We don't know what will happen with the returned command, so we need to mark this
-        // command as executed proactively.
+        // We proactively mark this command as executed since we can't be certain how the returned
+        // command will be handled. Caching must also be avoided here, as the inner command could be
+        // modified externally without us being aware.
         self.mark_as_executed();
-        self.should_cache = false;
+        self.cache_never();
         &mut self.command
     }