From 9818fa6fd49225029a44b7daaf30987a62656c73 Mon Sep 17 00:00:00 2001 From: Mike Landau Date: Sun, 1 Nov 2026 09:21:27 -0800 Subject: [PATCH] test(nix): fix Ctrl-C test sending the interrupt too early under DEVBOX_DEBUG TestRunScriptWaitsForCommandOnCtrlC waited for "command: started" before sending Ctrl-C. With DEVBOX_DEBUG=1 (set in CI), RunScript logs the script source, which contained that string verbatim, so the test sent Ctrl-C before the shell had installed its INT trap and the command exited with 130. Print the marker with printf so it no longer appears in the script source. Co-Authored-By: Claude Opus 5.5 (1M context) --- internal/nix/run_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/nix/run_test.go b/internal/nix/run_test.go index 979a96c7699..1a8ebd2bc05 100644 --- a/internal/nix/run_test.go +++ b/internal/nix/run_test.go @@ -28,8 +28,11 @@ func TestRunScriptHelper(t *testing.T) { if os.Getenv(runScriptHelperEnv) == "" { t.Skip("helper process for TestRunScriptWaitsForCommandOnCtrlC") } + // The test waits for "command: started", so it mustn't appear verbatim in + // the script: with DEVBOX_DEBUG=1 (as in CI), RunScript logs the script + // before running it, and the test would send Ctrl-C before the trap is set. script := `trap 'echo command: shutting down; sleep 0.5; echo command: shutdown complete; exit 3' INT -echo command: started +printf 'command: %s\n' started while true; do sleep 0.1; done` err := RunScript(t.TempDir(), script, map[string]string{"PATH": os.Getenv("PATH")}) var exitErr *usererr.ExitError