Files
tinygo/src/os/exec.go
T
dkegel-fastly 8135be4e90 GNUmakefile: add spellfix target, use it. (#4387)
TODO: Remove the go.mod/go.sum in internal/tools once doing so doesn't break CI (e.g. once we drop support for go 1.19)

* builder/cc1as.h: fix typo found by 'make spell'
* GNUmakefile: remove exception for inbetween, fix instance now found by 'make spell'
* GNUmakefile: remove exception for programmmer, fix instance now found by 'make spell'
* go.mod: use updated misspell. GNUmakefile: add spellfix target, use it.
* ignore directories properly when invoking spellchecker.
* make spell: give internal/tools its own go.mod, as misspell requires newer go
* make lint: depend on tools and run the installed revive
(which was perhaps implied by the change that added revive to internal/tools,
but not required in GNUmakefile until we gave internal/tools its own temporary go.mod)
* .github: now that 'make spell' works well, run it from CI
* GNUmakefile: make spell now aborts if it finds misspelt words, so what it finds doesn't get lost in CI logs
* GNUmakefile: tools: avoid -C option on go generate to make test-llvm15-go119 circleci job happy, see
https://cs.opensource.google/go/go/+/2af48cbb7d85e5fdc635e75b99f949010c607786
* internal/tools/go.mod: fix format of go version to leave out patchlevel, else go complains.
2024-08-12 14:24:38 -07:00

96 lines
2.1 KiB
Go

package os
import (
"errors"
"syscall"
)
type Signal interface {
String() string
Signal() // to distinguish from other Stringers
}
// Getpid returns the process id of the caller, or -1 if unavailable.
func Getpid() int {
return syscall.Getpid()
}
// Getppid returns the process id of the caller's parent, or -1 if unavailable.
func Getppid() int {
return syscall.Getppid()
}
type ProcAttr struct {
Dir string
Env []string
Files []*File
Sys *syscall.SysProcAttr
}
// 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
}
// 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
}
func StartProcess(name string, argv []string, attr *ProcAttr) (*Process, error) {
return nil, &PathError{Op: "fork/exec", Path: name, Err: ErrNotImplemented}
}
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
}
// Release releases any resources associated with the Process p,
// rendering it unusable in the future.
// Release only needs to be called if Wait is not.
func (p *Process) Release() error {
return p.release()
}
// FindProcess looks for a running process by its pid.
// Keep compatibility with golang and always succeed and return new proc with pid on Linux.
func FindProcess(pid int) (*Process, error) {
return findProcess(pid)
}