Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 7 additions & 42 deletions src/os/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import (
"syscall"
)

// Errors StartProcess returns for a ProcAttr that it cannot honour. On a
// hosted OS only ErrNotImplementedSys is reachable. The other two stay because
// they are part of the exported API of this package.
var (
ErrNotImplementedDir = errors.New("directory setting not implemented")
ErrNotImplementedSys = errors.New("sys setting not implemented")
Expand Down Expand Up @@ -36,35 +39,12 @@ type ProcAttr struct {
// ErrProcessDone indicates a Process has finished.
var ErrProcessDone = errors.New("os: process already finished")

type ProcessState struct {
}

func (p *ProcessState) String() string {
return "" // TODO
}
func (p *ProcessState) Success() bool {
return false // TODO
}

// Sys returns system-dependent exit information about
// the process. Convert it to the appropriate underlying
// type, such as syscall.WaitStatus on Unix, to access its contents.
func (p *ProcessState) Sys() interface{} {
return nil // TODO
}

func (p *ProcessState) Exited() bool {
return false // TODO
}

// ExitCode returns the exit code of the exited process, or -1
// if the process hasn't exited or was terminated by a signal.
func (p *ProcessState) ExitCode() int {
return -1 // TODO
}

type Process struct {
Pid int

// done reports whether Wait reaped this process. A signal to a reaped pid
// is unsafe, because the number can belong to an unrelated process.
done int32
}

// StartProcess starts a new process with the program, arguments and attributes specified by name, argv and attr.
Expand All @@ -73,21 +53,6 @@ func StartProcess(name string, argv []string, attr *ProcAttr) (*Process, error)
return startProcess(name, argv, attr)
}

func (p *Process) Wait() (*ProcessState, error) {
if p.Pid == -1 {
return nil, syscall.EINVAL
}
return nil, ErrNotImplemented
}

func (p *Process) Kill() error {
return ErrNotImplemented
}

func (p *Process) Signal(sig Signal) error {
return ErrNotImplemented
}

func Ignore(sig ...Signal) {
// leave all the signals unaltered
return
Expand Down
103 changes: 0 additions & 103 deletions src/os/exec_linux.go

This file was deleted.

78 changes: 0 additions & 78 deletions src/os/exec_linux_test.go

This file was deleted.

45 changes: 44 additions & 1 deletion src/os/exec_other.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build (!aix && !android && !freebsd && !linux && !netbsd && !openbsd && !plan9 && !solaris) || baremetal || tinygo.wasm || nintendoswitch
//go:build (!aix && !android && !darwin && !freebsd && !linux && !netbsd && !openbsd && !plan9 && !solaris) || baremetal || tinygo.wasm || nintendoswitch

package os

Expand All @@ -18,6 +18,49 @@ func (p *Process) release() error {
return nil
}

// ProcessState is a placeholder on targets that have no process model.
type ProcessState struct {
}

func (p *ProcessState) String() string {
return "" // TODO
}
func (p *ProcessState) Success() bool {
return false // TODO
}

// Sys returns system-dependent exit information about
// the process. Convert it to the appropriate underlying
// type, such as syscall.WaitStatus on Unix, to access its contents.
func (p *ProcessState) Sys() interface{} {
return nil // TODO
}

func (p *ProcessState) Exited() bool {
return false // TODO
}

// ExitCode returns the exit code of the exited process, or -1
// if the process hasn't exited or was terminated by a signal.
func (p *ProcessState) ExitCode() int {
return -1 // TODO
}

func (p *Process) Wait() (*ProcessState, error) {
if p.Pid == -1 {
return nil, syscall.EINVAL
}
return nil, ErrNotImplemented
}

func (p *Process) Kill() error {
return ErrNotImplemented
}

func (p *Process) Signal(sig Signal) error {
return ErrNotImplemented
}

func forkExec(_ string, _ []string, _ *ProcAttr) (pid int, err error) {
return 0, ErrNotImplemented
}
Expand Down
Loading