@@ -9,7 +9,7 @@ use std::{
99} ;
1010
1111use bincode:: { Decode , Encode } ;
12- use fspy:: { AccessMode , Spy , TrackedChild } ;
12+ use fspy:: { AccessMode , Spy } ;
1313use futures_util:: future:: try_join3;
1414use serde:: { Deserialize , Serialize } ;
1515use sha2:: { Digest , Sha256 } ;
@@ -402,87 +402,87 @@ pub async fn execute_task(
402402 cmd. current_dir ( base_dir. join ( & resolved_command. fingerprint . cwd ) )
403403 . stdout ( Stdio :: piped ( ) )
404404 . stderr ( Stdio :: piped ( ) ) ;
405- let TrackedChild { tokio_child : mut child, accesses_future } = cmd. spawn ( ) . await ?;
405+ let mut child = cmd. spawn ( ) . await ?;
406406
407407 let child_stdout = child. stdout . take ( ) . unwrap ( ) ;
408408 let child_stderr = child. stderr . take ( ) . unwrap ( ) ;
409409
410410 let outputs = Mutex :: new ( Vec :: < StdOutput > :: new ( ) ) ;
411411
412- let path_accesses_fut = async move {
413- let path_accesses = accesses_future. await ?;
414- let mut path_reads = HashMap :: < RelativePathBuf , PathRead > :: new ( ) ;
415- let mut path_writes = HashMap :: < RelativePathBuf , PathWrite > :: new ( ) ;
416- for access in path_accesses. iter ( ) {
417- let relative_path = access
418- . path
419- . strip_path_prefix ( base_dir, |strip_result| {
420- let Ok ( stripped_path) = strip_result else {
421- return None ;
422- } ;
423- Some ( RelativePathBuf :: new ( stripped_path) . map_err ( |err| {
424- Error :: InvalidRelativePath { path : stripped_path. into ( ) , reason : err }
425- } ) )
426- } )
427- . transpose ( ) ?;
428-
429- let Some ( relative_path) = relative_path else {
430- // ignore accesses outside the workspace
431- continue ;
432- } ;
433- if relative_path. as_path ( ) . strip_prefix ( ".git" ) . is_ok ( ) {
434- // temp workaround for oxlint reading inside .git
435- continue ;
436- }
437- match access. mode {
438- AccessMode :: Read => {
439- path_reads. entry ( relative_path) . or_insert ( PathRead { read_dir_entries : false } ) ;
440- }
441- AccessMode :: Write => {
442- path_writes. insert ( relative_path, PathWrite ) ;
443- }
444- AccessMode :: ReadWrite => {
445- path_reads
446- . entry ( relative_path. clone ( ) )
447- . or_insert ( PathRead { read_dir_entries : false } ) ;
448- path_writes. insert ( relative_path, PathWrite ) ;
449- }
450- AccessMode :: ReadDir => match path_reads. entry ( relative_path) {
451- Entry :: Occupied ( mut occupied) => occupied. get_mut ( ) . read_dir_entries = true ,
452- Entry :: Vacant ( vacant) => {
453- vacant. insert ( PathRead { read_dir_entries : true } ) ;
454- }
455- } ,
456- }
457- }
458- Ok :: < _ , Error > ( ( path_reads, path_writes) )
459- } ;
460-
461- let ( ( ) , ( ) , ( exit_status, duration) ) = try_join3 (
412+ let ( ( ) , ( ) , ( termination, duration) ) = try_join3 (
462413 collect_std_outputs ( & outputs, child_stdout, OutputKind :: StdOut ) ,
463414 collect_std_outputs ( & outputs, child_stderr, OutputKind :: StdErr ) ,
464415 async move {
465416 let start = Instant :: now ( ) ;
466- let exit_status = child. wait ( ) . await ?;
417+ let exit_status = child. wait_handle . await ?;
467418 Ok ( ( exit_status, start. elapsed ( ) ) )
468419 } ,
469420 )
470421 . await ?;
471422
472- let ( path_reads, path_writes) = path_accesses_fut. await ?;
423+ let mut path_reads = HashMap :: < RelativePathBuf , PathRead > :: new ( ) ;
424+ let mut path_writes = HashMap :: < RelativePathBuf , PathWrite > :: new ( ) ;
425+ for access in termination. path_accesses . iter ( ) {
426+ let relative_path = access
427+ . path
428+ . strip_path_prefix ( base_dir, |strip_result| {
429+ let Ok ( stripped_path) = strip_result else {
430+ return None ;
431+ } ;
432+ Some ( RelativePathBuf :: new ( stripped_path) . map_err ( |err| {
433+ Error :: InvalidRelativePath { path : stripped_path. into ( ) , reason : err }
434+ } ) )
435+ } )
436+ . transpose ( ) ?;
437+
438+ let Some ( relative_path) = relative_path else {
439+ // ignore accesses outside the workspace
440+ continue ;
441+ } ;
442+ if relative_path. as_path ( ) . strip_prefix ( ".git" ) . is_ok ( ) {
443+ // temp workaround for oxlint reading inside .git
444+ continue ;
445+ }
446+ match access. mode {
447+ AccessMode :: Read => {
448+ path_reads. entry ( relative_path) . or_insert ( PathRead { read_dir_entries : false } ) ;
449+ }
450+ AccessMode :: Write => {
451+ path_writes. insert ( relative_path, PathWrite ) ;
452+ }
453+ AccessMode :: ReadWrite => {
454+ path_reads
455+ . entry ( relative_path. clone ( ) )
456+ . or_insert ( PathRead { read_dir_entries : false } ) ;
457+ path_writes. insert ( relative_path, PathWrite ) ;
458+ }
459+ AccessMode :: ReadDir => match path_reads. entry ( relative_path) {
460+ Entry :: Occupied ( mut occupied) => occupied. get_mut ( ) . read_dir_entries = true ,
461+ Entry :: Vacant ( vacant) => {
462+ vacant. insert ( PathRead { read_dir_entries : true } ) ;
463+ }
464+ } ,
465+ }
466+ }
473467
474468 let outputs = outputs. into_inner ( ) . unwrap ( ) ;
475469 tracing:: debug!(
476470 "executed task finished, path_reads: {}, path_writes: {}, outputs: {}, exit_status: {}" ,
477471 path_reads. len( ) ,
478472 path_writes. len( ) ,
479473 outputs. len( ) ,
480- exit_status
474+ termination . status ,
481475 ) ;
482476
483477 // let input_paths = gather_inputs(task, base_dir)?;
484478
485- Ok ( ExecutedTask { std_outputs : outputs. into ( ) , exit_status, path_reads, path_writes, duration } )
479+ Ok ( ExecutedTask {
480+ std_outputs : outputs. into ( ) ,
481+ exit_status : termination. status ,
482+ path_reads,
483+ path_writes,
484+ duration,
485+ } )
486486}
487487
488488#[ expect( dead_code) ]
0 commit comments