Skip to content

Commit 8e4ba8b

Browse files
branchseerclaude
andcommitted
fix(e2e): use exec to improve SIGINT delivery on Unix
On Unix systems, running commands through a shell creates a process chain (sh → vite → node) which makes SIGINT delivery unreliable. Using 'exec' replaces the shell with the actual command, reducing the process hierarchy and making signal propagation work correctly. This fixes the ctrl-c-interruption test on Ubuntu where the SIGINT was not reaching the Node.js process, causing timeouts instead of graceful shutdowns. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent e08a14b commit 8e4ba8b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

  • crates/vite_task_bin/tests/e2e_snapshots

crates/vite_task_bin/tests/e2e_snapshots/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,15 @@ async fn run_case_inner(tmpdir: &AbsolutePath, fixture_path: &Path, fixture_name
175175
let mut e2e_outputs = String::new();
176176
for step in e2e.steps {
177177
let mut cmd = Command::new(&shell_exe);
178+
// On Unix, use exec to replace the shell with the command, reducing process hierarchy
179+
// This makes Ctrl+C signal propagation more reliable
180+
#[cfg(unix)]
181+
let cmd_str = format!("exec {}", step.cmd());
182+
#[cfg(not(unix))]
183+
let cmd_str = step.cmd().to_string();
184+
178185
cmd.arg("-c")
179-
.arg(step.cmd())
186+
.arg(cmd_str)
180187
.env_clear()
181188
.env("PATH", &e2e_env_path)
182189
.env("NO_COLOR", "1")

0 commit comments

Comments
 (0)