os.Executable rather than os.Args[0]

This commit is contained in:
Nuno Cruces
2024-09-04 18:44:09 +01:00
parent 35c5619880
commit 75190a6f98
5 changed files with 21 additions and 16 deletions

View File

@@ -131,7 +131,12 @@ func TestMultiProcess(t *testing.T) {
"&_pragma=journal_mode(truncate)" +
"&_pragma=synchronous(off)"
cmd := exec.Command(os.Args[0], append(os.Args[1:], "-test.v", "-test.run=TestChildProcess")...)
exe, err := os.Executable()
if err != nil {
t.Fatal(err)
}
cmd := exec.Command(exe, append(os.Args[1:], "-test.v", "-test.run=TestChildProcess")...)
out, err := cmd.StdoutPipe()
if err != nil {
t.Fatal(err)