github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/os/exec.go (about)

     1  package os
     2  
     3  import (
     4  	"errors"
     5  	"syscall"
     6  )
     7  
     8  type Signal interface {
     9  	String() string
    10  	Signal() // to distinguish from other Stringers
    11  }
    12  
    13  // Getpid returns the process id of the caller, or -1 if unavailable.
    14  func Getpid() int {
    15  	return syscall.Getpid()
    16  }
    17  
    18  // Getppid returns the process id of the caller's parent, or -1 if unavailable.
    19  func Getppid() int {
    20  	return syscall.Getppid()
    21  }
    22  
    23  type ProcAttr struct {
    24  	Dir   string
    25  	Env   []string
    26  	Files []*File
    27  	Sys   *syscall.SysProcAttr
    28  }
    29  
    30  // ErrProcessDone indicates a Process has finished.
    31  var ErrProcessDone = errors.New("os: process already finished")
    32  
    33  type ProcessState struct {
    34  }
    35  
    36  func (p *ProcessState) String() string {
    37  	return "" // TODO
    38  }
    39  func (p *ProcessState) Success() bool {
    40  	return false // TODO
    41  }
    42  
    43  // Sys returns system-dependent exit information about
    44  // the process. Convert it to the appropriate underlying
    45  // type, such as syscall.WaitStatus on Unix, to access its contents.
    46  func (p *ProcessState) Sys() interface{} {
    47  	return nil // TODO
    48  }
    49  
    50  // ExitCode returns the exit code of the exited process, or -1
    51  // if the process hasn't exited or was terminated by a signal.
    52  func (p *ProcessState) ExitCode() int {
    53  	return -1 // TODO
    54  }
    55  
    56  type Process struct {
    57  	Pid int
    58  }
    59  
    60  func StartProcess(name string, argv []string, attr *ProcAttr) (*Process, error) {
    61  	return nil, &PathError{"fork/exec", name, ErrNotImplemented}
    62  }
    63  
    64  func (p *Process) Wait() (*ProcessState, error) {
    65  	return nil, ErrNotImplemented
    66  }
    67  
    68  func (p *Process) Kill() error {
    69  	return ErrNotImplemented
    70  }
    71  
    72  func (p *Process) Signal(sig Signal) error {
    73  	return ErrNotImplemented
    74  }