unix: use os.Executable rather than os.Args[0] in tests

Change-Id: I67a063d747c6e34dcd0292fdb3a9a0d965a6e133
Reviewed-on: https://go-review.googlesource.com/c/sys/+/607875
Commit-Queue: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Ian Lance Taylor
2024-08-22 21:01:30 +00:00
committed by Gopher Robot
parent a8c5219b5e
commit 29e55b2fd3
4 changed files with 12 additions and 4 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ func init() {
// testCmd generates a proper command that, when executed, runs the test
// corresponding to the given key.
func testCmd(procName string) (*exec.Cmd, error) {
exe, err := filepath.Abs(os.Args[0])
exe, err := os.Executable()
if err != nil {
return nil, err
}