Skip to content

Commit 50c0e12

Browse files
branchseerclaude
andcommitted
fix(e2e): use process groups for reliable SIGINT delivery
Instead of using 'exec' which breaks shell syntax like environment variable assignments, create a new process group on Unix platforms. This allows send_ctrlc to deliver SIGINT to the entire process tree including sh -> vite -> node chains. The previous 'exec' approach failed for commands like: FOO=1 vite run hello because exec can't handle shell variable assignment syntax. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 8e4ba8b commit 50c0e12

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

  • crates/vite_task_bin/tests/e2e_snapshots

crates/vite_task_bin/tests/e2e_snapshots/main.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,21 @@ 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-
185178
cmd.arg("-c")
186-
.arg(cmd_str)
179+
.arg(step.cmd())
187180
.env_clear()
188181
.env("PATH", &e2e_env_path)
189182
.env("NO_COLOR", "1")
190183
.current_dir(e2e_stage_path.join(&e2e.cwd));
191184

185+
// Create a new process group on Unix so we can send signals to the entire group
186+
#[cfg(unix)]
187+
{
188+
#[allow(unused_imports)]
189+
use std::os::unix::process::CommandExt;
190+
cmd.process_group(0);
191+
}
192+
192193
// On Windows, inherit PATHEXT for executable lookup
193194
if cfg!(windows) {
194195
if let Ok(pathext) = std::env::var("PATHEXT") {

0 commit comments

Comments
 (0)