@@ -2,10 +2,9 @@ pub mod fingerprint;
22pub mod glob_inputs;
33pub mod spawn;
44
5- use std:: { collections:: BTreeMap , process:: Stdio , sync:: Arc } ;
5+ use std:: { collections:: BTreeMap , io :: Write as _ , process:: Stdio , sync:: Arc } ;
66
77use futures_util:: FutureExt ;
8- use tokio:: io:: AsyncWriteExt as _;
98use vite_path:: AbsolutePath ;
109use vite_task_plan:: {
1110 ExecutionGraph , ExecutionItemDisplay , ExecutionItemKind , LeafExecutionKind , SpawnCommand ,
@@ -144,21 +143,18 @@ impl ExecutionContext<'_> {
144143 LeafExecutionKind :: InProcess ( in_process_execution) => {
145144 // In-process (built-in) commands: caching is disabled, execute synchronously
146145 let mut stdio_config = leaf_reporter
147- . start ( CacheStatus :: Disabled ( CacheDisabledReason :: InProcessExecution ) )
148- . await ;
146+ . start ( CacheStatus :: Disabled ( CacheDisabledReason :: InProcessExecution ) ) ;
149147
150148 let execution_output = in_process_execution. execute ( ) ;
151149 // Write output to the stdout writer from StdioConfig
152- let _ = stdio_config. stdout_writer . write_all ( & execution_output. stdout ) . await ;
153- let _ = stdio_config. stdout_writer . flush ( ) . await ;
150+ let _ = stdio_config. stdout_writer . write_all ( & execution_output. stdout ) ;
151+ let _ = stdio_config. stdout_writer . flush ( ) ;
154152
155- leaf_reporter
156- . finish (
157- None ,
158- CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
159- None ,
160- )
161- . await ;
153+ leaf_reporter. finish (
154+ None ,
155+ CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
156+ None ,
157+ ) ;
162158 false
163159 }
164160 LeafExecutionKind :: Spawn ( spawn_execution) => {
@@ -220,13 +216,11 @@ pub async fn execute_spawn(
220216 ) {
221217 Ok ( inputs) => inputs,
222218 Err ( err) => {
223- leaf_reporter
224- . finish (
225- None ,
226- CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
227- Some ( ExecutionError :: Cache { kind : CacheErrorKind :: Lookup , source : err } ) ,
228- )
229- . await ;
219+ leaf_reporter. finish (
220+ None ,
221+ CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
222+ Some ( ExecutionError :: Cache { kind : CacheErrorKind :: Lookup , source : err } ) ,
223+ ) ;
230224 return SpawnOutcome :: Failed ;
231225 }
232226 } ;
@@ -247,13 +241,11 @@ pub async fn execute_spawn(
247241 Err ( err) => {
248242 // Cache lookup error — report through finish.
249243 // Note: start() is NOT called because we don't have a valid cache status.
250- leaf_reporter
251- . finish (
252- None ,
253- CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
254- Some ( ExecutionError :: Cache { kind : CacheErrorKind :: Lookup , source : err } ) ,
255- )
256- . await ;
244+ leaf_reporter. finish (
245+ None ,
246+ CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
247+ Some ( ExecutionError :: Cache { kind : CacheErrorKind :: Lookup , source : err } ) ,
248+ ) ;
257249 return SpawnOutcome :: Failed ;
258250 }
259251 }
@@ -263,23 +255,25 @@ pub async fn execute_spawn(
263255 } ;
264256
265257 // 2. Report execution start with the determined cache status.
266- // Returns StdioConfig with the reporter's suggestion and async writers.
267- let mut stdio_config = leaf_reporter. start ( cache_status) . await ;
258+ // Returns StdioConfig with the reporter's suggestion and writers.
259+ let mut stdio_config = leaf_reporter. start ( cache_status) ;
268260
269261 // 3. If cache hit, replay outputs via the StdioConfig writers and finish early.
270262 // No need to actually execute the command — just replay what was cached.
271263 if let Some ( cached) = cached_value {
272264 for output in cached. std_outputs . iter ( ) {
273- let writer: & mut ( dyn tokio :: io:: AsyncWrite + Unpin ) = match output. kind {
265+ let writer: & mut dyn std :: io:: Write = match output. kind {
274266 spawn:: OutputKind :: StdOut => & mut stdio_config. stdout_writer ,
275267 spawn:: OutputKind :: StdErr => & mut stdio_config. stderr_writer ,
276268 } ;
277- let _ = writer. write_all ( & output. content ) . await ;
278- let _ = writer. flush ( ) . await ;
269+ let _ = writer. write_all ( & output. content ) ;
270+ let _ = writer. flush ( ) ;
279271 }
280- leaf_reporter
281- . finish ( None , CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheHit ) , None )
282- . await ;
272+ leaf_reporter. finish (
273+ None ,
274+ CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheHit ) ,
275+ None ,
276+ ) ;
283277 return SpawnOutcome :: CacheHit ;
284278 }
285279
@@ -293,29 +287,25 @@ pub async fn execute_spawn(
293287 if use_inherited {
294288 // Inherited mode: all three stdio FDs (stdin, stdout, stderr) are inherited
295289 // from the parent process. No fspy tracking, no output capture.
296- // Drop the StdioConfig writers before spawning to avoid holding tokio ::io::Stdout
290+ // Drop the StdioConfig writers before spawning to avoid holding std ::io::Stdout
297291 // while the child also writes to the same FD.
298292 drop ( stdio_config) ;
299293
300294 match spawn_inherited ( & spawn_execution. spawn_command ) . await {
301295 Ok ( result) => {
302- leaf_reporter
303- . finish (
304- Some ( result. exit_status ) ,
305- CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
306- None ,
307- )
308- . await ;
296+ leaf_reporter. finish (
297+ Some ( result. exit_status ) ,
298+ CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
299+ None ,
300+ ) ;
309301 return SpawnOutcome :: Spawned ( result. exit_status ) ;
310302 }
311303 Err ( err) => {
312- leaf_reporter
313- . finish (
314- None ,
315- CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
316- Some ( ExecutionError :: Spawn ( err) ) ,
317- )
318- . await ;
304+ leaf_reporter. finish (
305+ None ,
306+ CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
307+ Some ( ExecutionError :: Spawn ( err) ) ,
308+ ) ;
319309 return SpawnOutcome :: Failed ;
320310 }
321311 }
@@ -346,13 +336,11 @@ pub async fn execute_spawn(
346336 {
347337 Ok ( negs) => negs,
348338 Err ( err) => {
349- leaf_reporter
350- . finish (
351- None ,
352- CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
353- Some ( ExecutionError :: PostRunFingerprint ( err) ) ,
354- )
355- . await ;
339+ leaf_reporter. finish (
340+ None ,
341+ CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
342+ Some ( ExecutionError :: PostRunFingerprint ( err) ) ,
343+ ) ;
356344 return SpawnOutcome :: Failed ;
357345 }
358346 }
@@ -367,8 +355,8 @@ pub async fn execute_spawn(
367355 let result = match spawn_with_tracking (
368356 & spawn_execution. spawn_command ,
369357 cache_base_path,
370- & mut stdio_config. stdout_writer ,
371- & mut stdio_config. stderr_writer ,
358+ & mut * stdio_config. stdout_writer ,
359+ & mut * stdio_config. stderr_writer ,
372360 std_outputs. as_mut ( ) ,
373361 path_accesses. as_mut ( ) ,
374362 & resolved_negatives,
@@ -377,13 +365,11 @@ pub async fn execute_spawn(
377365 {
378366 Ok ( result) => result,
379367 Err ( err) => {
380- leaf_reporter
381- . finish (
382- None ,
383- CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
384- Some ( ExecutionError :: Spawn ( err) ) ,
385- )
386- . await ;
368+ leaf_reporter. finish (
369+ None ,
370+ CacheUpdateStatus :: NotUpdated ( CacheNotUpdatedReason :: CacheDisabled ) ,
371+ Some ( ExecutionError :: Spawn ( err) ) ,
372+ ) ;
387373 return SpawnOutcome :: Failed ;
388374 }
389375 } ;
@@ -456,7 +442,7 @@ pub async fn execute_spawn(
456442 // 7. Finish the leaf execution with the result and optional cache error.
457443 // Cache update/fingerprint failures are reported but do not affect the outcome —
458444 // the process ran, so we return its actual exit status.
459- leaf_reporter. finish ( Some ( result. exit_status ) , cache_update_status, cache_error) . await ;
445+ leaf_reporter. finish ( Some ( result. exit_status ) , cache_update_status, cache_error) ;
460446
461447 SpawnOutcome :: Spawned ( result. exit_status )
462448}
@@ -560,6 +546,6 @@ impl Session<'_> {
560546
561547 // Leaf-level errors and non-zero exit statuses are tracked internally
562548 // by the reporter.
563- reporter. finish ( ) . await
549+ reporter. finish ( )
564550 }
565551}
0 commit comments