aboutsummaryrefslogtreecommitdiff
path: root/src/syscall/exec_windows_test.go
diff options
context:
space:
mode:
authorqmuntal <quimmuntal@gmail.com>2025-02-24 09:43:41 +0100
committerQuim Muntal <quimmuntal@gmail.com>2025-02-24 11:03:10 -0800
commitdceee2e983f5dab65c3905ecf40e70e15cf41b7d (patch)
tree90d8aec778115127028196a5de6b321008252b92 /src/syscall/exec_windows_test.go
parent2ee775fd9b58247618cf8bc06935f33875bdc872 (diff)
downloadgo-dceee2e983f5dab65c3905ecf40e70e15cf41b7d.tar.xz
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 <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
Diffstat (limited to 'src/syscall/exec_windows_test.go')
-rw-r--r--src/syscall/exec_windows_test.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/syscall/exec_windows_test.go b/src/syscall/exec_windows_test.go
index 5cacf42b6b..90a13af8d1 100644
--- a/src/syscall/exec_windows_test.go
+++ b/src/syscall/exec_windows_test.go
@@ -6,6 +6,7 @@ package syscall_test
import (
"fmt"
+ "internal/testenv"
"os"
"os/exec"
"path/filepath"
@@ -73,7 +74,7 @@ func TestChangingProcessParent(t *testing.T) {
// run parent process
- parent := exec.Command(os.Args[0], "-test.run=^TestChangingProcessParent$")
+ parent := exec.Command(testenv.Executable(t), "-test.run=^TestChangingProcessParent$")
parent.Env = append(os.Environ(), "GO_WANT_HELPER_PROCESS=parent")
err := parent.Start()
if err != nil {
@@ -96,7 +97,7 @@ func TestChangingProcessParent(t *testing.T) {
}
defer syscall.CloseHandle(ph)
- child := exec.Command(os.Args[0], "-test.run=^TestChangingProcessParent$")
+ child := exec.Command(testenv.Executable(t), "-test.run=^TestChangingProcessParent$")
child.Env = append(os.Environ(),
"GO_WANT_HELPER_PROCESS=child",
"GO_WANT_HELPER_PROCESS_FILE="+childDumpPath)