-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
process.go
43 lines (38 loc) · 770 Bytes
/
process.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
// Package process executes a binary
package process
import (
"io"
"github.com/go-micro/microwire/v5/runtime/local/build"
)
// Process manages a running process.
type Process interface {
// Executes a process to completion
Exec(*Executable) error
// Creates a new process
Fork(*Executable) (*PID, error)
// Kills the process
Kill(*PID) error
// Waits for a process to exit
Wait(*PID) error
}
type Executable struct {
// Package containing executable
Package *build.Package
// The env variables
Env []string
// Args to pass
Args []string
// Initial working directory
Dir string
}
// PID is the running process.
type PID struct {
// ID of the process
ID string
// Stdin
Input io.Writer
// Stdout
Output io.Reader
// Stderr
Error io.Reader
}