Skip to content

Commit 7903296

Browse files
branchseerclaude
andcommitted
fix(e2e): prevent timeout from hanging by exiting immediately
When timeout occurs, immediately kill the process and exit the loop without waiting for stdout/stderr pipes to drain. This prevents tests from hanging indefinitely on platforms where child processes don't close pipes properly after being killed. The previous implementation waited for pipes to close after timeout, which could hang if the process tree (sh -> vite -> node) didn't terminate cleanly. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent e62ad61 commit 7903296

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

  • crates/vite_task_bin/tests/e2e_snapshots

crates/vite_task_bin/tests/e2e_snapshots/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,15 +261,14 @@ async fn run_case_inner(tmpdir: &AbsolutePath, fixture_path: &Path, fixture_name
261261
termination_state = Some(TerminationState::Exited(result.unwrap()));
262262
}
263263
_ = &mut timeout, if termination_state.is_none() => {
264-
// Timeout - kill the process
264+
// Timeout - kill the process and exit immediately
265265
let _ = child.kill().await;
266-
termination_state = Some(TerminationState::TimedOut);
266+
break &TerminationState::TimedOut;
267267
}
268268
}
269269

270270
// Exit conditions:
271271
// 1. Process exited and all output drained
272-
// 2. Timed out and all output drained (after kill, pipes close)
273272
if let Some(termination_state) = &termination_state
274273
&& stdout_done
275274
&& stderr_done

0 commit comments

Comments
 (0)