File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -359,18 +359,21 @@ impl InputAction {
359
359
if matches ! ( self . build_kind, BuildKind :: Normal ) && !self . force_compile {
360
360
match fs:: File :: open ( & built_binary_path) {
361
361
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 ( ) ?) ;
365
368
match (
366
369
fs:: File :: open ( & self . script_path ) ,
367
370
fs:: File :: open ( manifest_path) ,
368
371
) {
369
372
( Ok ( script_file) , Ok ( manifest_file) ) => {
370
373
let script_mtime = script_file. metadata ( ) ?. modified ( ) ?;
371
374
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 ( )
374
377
{
375
378
debug ! ( "Keeping old binary" ) ;
376
379
return Ok ( execute_command ( ) ) ;
You can’t perform that action at this time.
0 commit comments