From 79d345096f61fbac3ccef58ebdab3c8aba7d3c6a Mon Sep 17 00:00:00 2001 From: Samuel K Date: Mon, 19 Oct 2026 21:30:30 -0600 Subject: [PATCH] test(command): avoid fork race in SIGTERM fixture --- pkg/command/process_test.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkg/command/process_test.go b/pkg/command/process_test.go index ab8948a3c9..dfc50a60e2 100644 --- a/pkg/command/process_test.go +++ b/pkg/command/process_test.go @@ -315,7 +315,13 @@ func startSigtermIgnoringGroup(t *testing.T) *exec.Cmd { t.Helper() ready := filepath.Join(t.TempDir(), "ready") // #nosec G204 -- the fixed shell script and all paths are test-controlled. - cmd := exec.Command("sh", "-c", `trap '' TERM; printf 'ready\n' > "$1"; sleep 30`, "sh", ready) + cmd := exec.Command( + "sh", + "-c", + `trap '' TERM; printf 'ready\n' > "$1"; exec sleep 30`, + "sh", + ready, + ) cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true} if err := cmd.Start(); err != nil { t.Fatalf("start SIGTERM-ignoring group: %v", err)