/
exec.go
74 lines (59 loc) · 1.56 KB
/
exec.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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{"fork/exec", name, ErrNotImplemented}
}
func (p *Process) Wait() (*ProcessState, error) {
return nil, ErrNotImplemented
}
func (p *Process) Kill() error {
return ErrNotImplemented
}
func (p *Process) Signal(sig Signal) error {
return ErrNotImplemented
}