diff --git a/src/os/exec_linux_test.go b/src/os/exec_linux_test.go index 6b660dadf6..42fb837ba8 100644 --- a/src/os/exec_linux_test.go +++ b/src/os/exec_linux_test.go @@ -18,7 +18,7 @@ func TestForkExec(t *testing.T) { return } - proc, err := StartProcess("echo", []string{"/bin/echo", "hello", "world"}, &ProcAttr{}) + proc, err := StartProcess("/bin/echo", []string{"hello", "world"}, &ProcAttr{}) if !errors.Is(err, nil) { t.Fatalf("forkExec failed: %v", err) } @@ -28,12 +28,15 @@ func TestForkExec(t *testing.T) { } t.Logf("forkExec succeeded: new process has pid %d", proc) - proc, err = StartProcess("invalid", []string{"/bin/nonexistent"}, &ProcAttr{}) - if errors.Is(err, nil) { - t.Fatalf("wanted err, got nil") +} + +func TestForkExecInvalid(t *testing.T) { + proc, err := StartProcess("invalid", []string{"invalid"}, &ProcAttr{}) + if !errors.Is(err, ErrNotExist) { + t.Fatalf("wanted ErrNotExist, got %s\n", err) } - if proc.Pid != 0 { - t.Fatalf("wanted 0, got %v", proc.Pid) + if proc != nil { + t.Fatalf("wanted nil, got %v\n", proc) } } diff --git a/src/os/os.test b/src/os/os.test new file mode 100755 index 0000000000..345ca96da3 Binary files /dev/null and b/src/os/os.test differ diff --git a/src/os/osexec.go b/src/os/osexec.go index cf280fe887..8d4c2d55ea 100644 --- a/src/os/osexec.go +++ b/src/os/osexec.go @@ -40,8 +40,6 @@ func execve(pathname string, argv []string, envv []string) error { ret, _, err := syscall.Syscall(syscall.SYS_EXECVE, uintptr(unsafe.Pointer(&argv0[0])), uintptr(unsafe.Pointer(&argv1[0])), uintptr(unsafe.Pointer(&env1[0]))) if int(ret) != 0 { - // errno := err.(syscall.Errno) - // return errno return err } diff --git a/src/os/signal/signal.go b/src/os/signal/signal.go deleted file mode 100644 index 814d42173b..0000000000 --- a/src/os/signal/signal.go +++ /dev/null @@ -1,16 +0,0 @@ -//go:build !baremetal - -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package signal - -import ( - "os" -) - -// Just stubbing the functions for now since signal handling is not yet implemented in tinygo -func Reset(sig ...os.Signal) {} -func Ignore(sig ...os.Signal) {} -func Notify(c chan<- os.Signal, sig ...os.Signal) {} diff --git a/src/syscall/exec_unix.go b/src/syscall/exec_unix.go deleted file mode 100644 index 2d92d5061e..0000000000 --- a/src/syscall/exec_unix.go +++ /dev/null @@ -1,7 +0,0 @@ -//go:build unix - -package syscall - -// Implemented in runtime package. -func runtime_BeforeExec() -func runtime_AfterExec()