Skip to content

Commit 1f5ccb8

Browse files
committed
add command cache key
1 parent f4abfac commit 1f5ccb8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/bootstrap/src/utils/exec.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ impl OutputMode {
5555
}
5656
}
5757

58+
#[derive(Clone, Debug, PartialEq, Eq, Hash, Default)]
59+
pub struct CommandCacheKey {
60+
program: String,
61+
args: Vec<String>,
62+
envs: Vec<(String, String)>,
63+
cwd: Option<PathBuf>,
64+
}
65+
5866
/// Wrapper around `std::process::Command`.
5967
///
6068
/// By default, the command will exit bootstrap if it fails.
@@ -225,6 +233,15 @@ impl<'a> BootstrapCommand {
225233
self.env("TERM", "xterm").args(["--color", "always"]);
226234
}
227235
}
236+
237+
pub fn cache_key(&self) -> CommandCacheKey {
238+
CommandCacheKey {
239+
program: self.program.clone(),
240+
args: self.args.clone(),
241+
envs: self.envs.clone(),
242+
cwd: self.cwd.clone(),
243+
}
244+
}
228245
}
229246

230247
impl Debug for BootstrapCommand {

0 commit comments

Comments
 (0)