Browse Source

wip

pull/4377/head
leongross 4 weeks ago
parent
commit
63c5958ed5
  1. 5
      src/os/exec_linux_test.go
  2. 4
      src/os/osexec.go

5
src/os/exec_linux_test.go

@ -3,6 +3,7 @@
package os_test
import (
"errors"
. "os"
"runtime"
"testing"
@ -17,8 +18,8 @@ func TestForkExec(t *testing.T) {
return
}
proc, err := StartProcess("echo", []string{"echo", "hello", "world"}, &ProcAttr{})
if err != nil {
proc, err := StartProcess("/bin/echo", []string{"hello", "world"}, &ProcAttr{})
if !errors.Is(err, nil) {
t.Fatalf("forkExec failed: %v", err)
return
}

4
src/os/osexec.go

@ -14,7 +14,9 @@ func fork() (pid int, err error) {
ret, _, err := syscall.Syscall(syscall.SYS_FORK, 0, 0, 0)
if int(ret) != 0 {
errno := err.(syscall.Errno)
return 0, errno
if int(errno) != 0 {
return -1, errno
}
}
return int(ret), nil
}

Loading…
Cancel
Save