-
Notifications
You must be signed in to change notification settings - Fork 2
/
process.go
31 lines (25 loc) · 1.12 KB
/
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
package nescript
import "os"
// Process is a single instance of the script, either running or exited. A
// process can be used to control the script and extract results from a script
// that has completed its execution.
type Process interface {
// Kill sends a SIGKILL to the running process. If this fails, for example if
// the process is not running, this will return an error.
Kill() error
// Signal sends a signal (such as SIGINT) to the running process. If this
// fails, for example if the process is not running, this will return an
// error.
Signal(os.Signal) error
// Write sends a string to the process's STDIN. Note that the string is sent
// as-is. Thus if the program is looking for a newline before the read is
// complete, this must be included in the string provided. If the write fails,
// an error is returned.
Write(string) error
// Result waits for a script to complete execution, then a result is returned.
// If the script returns an unknown error, this will also error.
Result() (*Result, error)
// Close should be called on a process, freeing any resources used where
// appropriate.
Close()
}