From dceee2e983f5dab65c3905ecf40e70e15cf41b7d Mon Sep 17 00:00:00 2001 From: qmuntal Date: Mon, 24 Feb 2025 09:43:41 +0100 Subject: all: use testenv.Executable instead of os.Executable and os.Args[0] In test files, using testenv.Executable is more reliable than os.Executable or os.Args[0]. Change-Id: I88e577efeabc20d02ada27bf706ae4523129128e Reviewed-on: https://go-review.googlesource.com/c/go/+/651955 Reviewed-by: Cherry Mui LUCI-TryBot-Result: Go LUCI Reviewed-by: Ian Lance Taylor --- src/internal/syscall/windows/exec_windows_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/internal/syscall/windows/exec_windows_test.go') diff --git a/src/internal/syscall/windows/exec_windows_test.go b/src/internal/syscall/windows/exec_windows_test.go index 72550b5a84..fc694199f7 100644 --- a/src/internal/syscall/windows/exec_windows_test.go +++ b/src/internal/syscall/windows/exec_windows_test.go @@ -9,6 +9,7 @@ package windows_test import ( "fmt" "internal/syscall/windows" + "internal/testenv" "os" "os/exec" "syscall" @@ -29,7 +30,7 @@ func TestRunAtLowIntegrity(t *testing.T) { return } - cmd := exec.Command(os.Args[0], "-test.run=^TestRunAtLowIntegrity$", "--") + cmd := exec.Command(testenv.Executable(t), "-test.run=^TestRunAtLowIntegrity$", "--") cmd.Env = []string{"GO_WANT_HELPER_PROCESS=1"} token, err := getIntegrityLevelToken(sidWilLow) -- cgit v1.3-5-g9baa