test: use t.Context() for helper subprocess

This commit is contained in:
sam committed 2026-08-16 01:08:47 +10:00
1 parent 40441c7655
commit 89af556fa0
1 file changed
+3 -1
+3 -1
View File
@@ -190,6 +190,8 @@ func testRequest() Request {
}
func TestAgentHelperProcess(t *testing.T) {
ctx := t.Context()
if os.Getenv("GO_WANT_AGENT_HELPER") != "1" {
return
}
@@ -227,7 +229,7 @@ func TestAgentHelperProcess(t *testing.T) {
case "hang":
time.Sleep(10 * time.Second)
case "spawn-grandchild":
cmd := exec.Command("/bin/sh", "-c", `sleep 0.2; printf survived > "$AGENT_HELPER_MARKER"`)
cmd := exec.CommandContext(ctx, "/bin/sh", "-c", `sleep 0.2; printf survived > "$AGENT_HELPER_MARKER"`)
cmd.Env = os.Environ()
if err := cmd.Start(); err != nil {
fmt.Fprintln(os.Stderr, err)