File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -359,18 +359,21 @@ impl InputAction {
359359 if matches ! ( self . build_kind, BuildKind :: Normal ) && !self . force_compile {
360360 match fs:: File :: open ( & built_binary_path) {
361361 Ok ( built_binary_file) => {
362- // Use ctime instead of mtime as cargo may copy an already
363- // built binary (with old mtime) here:
364- let built_binary_ctime = built_binary_file. metadata ( ) ?. created ( ) ?;
362+ // When possible, use creation time instead of modified time as cargo may copy
363+ // an already built binary (with old modified time):
364+ let built_binary_time = built_binary_file
365+ . metadata ( ) ?
366+ . created ( )
367+ . unwrap_or ( built_binary_file. metadata ( ) ?. modified ( ) ?) ;
365368 match (
366369 fs:: File :: open ( & self . script_path ) ,
367370 fs:: File :: open ( manifest_path) ,
368371 ) {
369372 ( Ok ( script_file) , Ok ( manifest_file) ) => {
370373 let script_mtime = script_file. metadata ( ) ?. modified ( ) ?;
371374 let manifest_mtime = manifest_file. metadata ( ) ?. modified ( ) ?;
372- if built_binary_ctime . cmp ( & script_mtime) . is_ge ( )
373- && built_binary_ctime . cmp ( & manifest_mtime) . is_ge ( )
375+ if built_binary_time . cmp ( & script_mtime) . is_ge ( )
376+ && built_binary_time . cmp ( & manifest_mtime) . is_ge ( )
374377 {
375378 debug ! ( "Keeping old binary" ) ;
376379 return Ok ( execute_command ( ) ) ;
You can’t perform that action at this time.
0 commit comments