From 69ed39c4acb8c9ad736f1fc8d1b649cb5f6adcb8 Mon Sep 17 00:00:00 2001 From: lew Date: Thu, 20 Nov 2025 15:41:31 +0000 Subject: [PATCH] fix(cmdtest): create binary in /tmp --- main_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main_test.go b/main_test.go index 120b187..7f977cb 100644 --- a/main_test.go +++ b/main_test.go @@ -23,8 +23,8 @@ package main import ( "flag" - "os" "os/exec" + "path/filepath" "testing" cmdtest "github.com/google/go-cmdtest" @@ -38,10 +38,10 @@ func TestMain(t *testing.T) { if err != nil { t.Fatalf("read testdata: %v", err) } - if err := exec.Command("go", "build", ".").Run(); err != nil { + bin := filepath.Join(t.TempDir(), "pda") + if err := exec.Command("go", "build", "-o", bin, ".").Run(); err != nil { t.Fatal(err) } - defer os.Remove("pda") - ts.Commands["pda"] = cmdtest.Program("pda") + ts.Commands["pda"] = cmdtest.Program(bin) ts.Run(t, *update) }