Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Process ¶
type Process struct {
Chdir string `json:"chdir" yaml:"chdir"` // cd /tmp
Env map[string]string `json:"env" yaml:"env"` // env FOO=BAR
Argv []string `json:"argv" yaml:"argv"` // "/bin/dd" "if=/dev/zero" "count=10"
Stdin string `json:"stdin" yaml:"stdin"` // <"/dev/null"
Stdout string `json:"stdout" yaml:"stdout"` // >"zero.bin"
Stderr string `json:"stderr" yaml:"stderr"` // 2>"errors.log"
Uid int `json:"uid" yaml:"uid"` // 1337
Gid int `json:"gid" yaml:"gid"` // 1337
PreserveEnvironment bool `json:"preserve_environment" yaml:"preserve_environment"`
}
Process is the configuration for running a process
func NewProcess ¶
func NewProcess() Process
NewProcess returns a Process struct with the env map and argv allocated and all stdio pointed at /dev/null. argv is allocated with a length of 1 to hold the command. Use append to add arguments.
func (*Process) Exec ¶
Exec executes Argv with environment Env and file descriptors 1, 2, and 3 open on the files specified in Stdin, Stdout, and Stderr. When output files are unspecified or an empty string, the file descriptors are left unmodified. If argv[0] is stat-able (absolute or relative path), it is used as-is. When that fails the PATH searched using exec.LookPath().
Click to show internal directories.
Click to hide internal directories.