Skip to content

Commit 63c5958

Browse files
committed
wip
1 parent a6e4bad commit 63c5958

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/os/exec_linux_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package os_test
44

55
import (
6+
"errors"
67
. "os"
78
"runtime"
89
"testing"
@@ -17,8 +18,8 @@ func TestForkExec(t *testing.T) {
1718
return
1819
}
1920

20-
proc, err := StartProcess("echo", []string{"echo", "hello", "world"}, &ProcAttr{})
21-
if err != nil {
21+
proc, err := StartProcess("/bin/echo", []string{"hello", "world"}, &ProcAttr{})
22+
if !errors.Is(err, nil) {
2223
t.Fatalf("forkExec failed: %v", err)
2324
return
2425
}

src/os/osexec.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ func fork() (pid int, err error) {
1414
ret, _, err := syscall.Syscall(syscall.SYS_FORK, 0, 0, 0)
1515
if int(ret) != 0 {
1616
errno := err.(syscall.Errno)
17-
return 0, errno
17+
if int(errno) != 0 {
18+
return -1, errno
19+
}
1820
}
1921
return int(ret), nil
2022
}

0 commit comments

Comments
 (0)