File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -146,7 +146,24 @@ impl ExecutionContext {
146
146
stdout : OutputMode ,
147
147
stderr : OutputMode ,
148
148
) -> CommandOutput {
149
- self . start ( command, stdout, stderr) . wait_for_output ( self )
149
+ let cache_key = command. cache_key ( ) ;
150
+
151
+ if let Some ( cached_output) = self . command_cache . get ( & cache_key) {
152
+ command. mark_as_executed ( ) ;
153
+ if self . dry_run ( ) && !command. run_always {
154
+ return CommandOutput :: default ( ) ;
155
+ }
156
+ self . verbose ( || println ! ( "Cache hit: {:?}" , command) ) ;
157
+ return cached_output;
158
+ }
159
+
160
+ let output = self . start ( command, stdout, stderr) . wait_for_output ( self ) ;
161
+
162
+ if output != CommandOutput :: default ( ) {
163
+ self . command_cache . insert ( cache_key, output. clone ( ) ) ;
164
+ }
165
+
166
+ output
150
167
}
151
168
152
169
fn fail ( & self , message : & str , output : CommandOutput ) -> ! {
You can’t perform that action at this time.
0 commit comments