Documentation ¶
Index ¶
- Variables
- func PidOf(name string) (res []int)
- func Reap() error
- func Run(arg ...string) error
- func RunGet(arg ...string) ([]byte, error)
- func RunJson(obj interface{}, arg ...string) error
- func RunWrite(r io.Reader, arg ...string) error
- func Sh(cmd string) error
- func ShQuote(s string) string
- type Env
- func (e Env) Contains(k string) bool
- func (e Env) Dedup() Env
- func (e Env) Get(k string) string
- func (e Env) Join(others ...Env) Env
- func (e Env) Run(arg ...string) error
- func (e Env) RunGet(arg ...string) ([]byte, error)
- func (e Env) RunJson(obj interface{}, arg ...string) error
- func (e Env) RunPipe(r io.Reader, arg ...string) (Pipe, error)
- func (e Env) RunRead(arg ...string) (Pipe, error)
- func (e Env) RunWrite(r io.Reader, arg ...string) error
- func (e *Env) Set(k, v string)
- func (e *Env) Unset(k string)
- type LinuxProcState
- type Pipe
- type ProcState
Constants ¶
This section is empty.
Variables ¶
var ( ErrCommandMissing = errors.New("command is missing") ErrNotSupported = errors.New("operation not supported on this platform") )
Functions ¶
func Run ¶
Run is a very simple invokation of command run, with output forwarded to stdout. This will wait for the command to complete.
func RunJson ¶
RunJson executes the command and applies its output to the specified object, parsing json data
Types ¶
type Env ¶ added in v0.2.3
type Env []string
func SysEnv ¶ added in v0.2.3
func SysEnv() Env
SysEnv returns a nil Env object that would mean pointing to the OS's environ
func (Env) Contains ¶ added in v0.2.3
Contains checks if the given env contains any value k, and confirm if the value exists or not
func (Env) Join ¶ added in v0.2.3
Join appends in one shot multiple environments together. No check for duplicates is done
func (Env) Run ¶ added in v0.2.3
Run is a very simple invokation of command run, with output forwarded to stdout. This will wait for the command to complete.
func (Env) RunGet ¶ added in v0.2.3
RunGet executes the command and returns its output as a buffer after it completes.
func (Env) RunJson ¶ added in v0.2.3
RunJson executes the command and applies its output to the specified object, parsing json data
func (Env) RunRead ¶ added in v0.2.3
RunRead executes the command in background and returns its output as a stream. Close the stream to kill the command and release its resources.
func (Env) RunWrite ¶ added in v0.2.3
RunWrite executes the command and passes r as its input, waiting for it to complete.
type LinuxProcState ¶ added in v0.2.0
type LinuxProcState struct { Pid int Comm string // "bash", etc State byte // 'R', 'S', 'D', 'Z', 'T', 't', 'W', etc PPid int // parent pid PGrp int // group id Session int // session TtyNr int // tty number Tpgid int Flags uint // PF_* flags Minflt uint64 // faults Cminflt uint64 Majflt uint64 Cmajflt uint64 Utime uint64 Stime uint64 Cutime uint64 Cstime uint64 Priority int64 Nice int64 // range 19 (low priority) to -20 (high priority). NumThreads int64 Itrealvalue int64 // The time in jiffies before the next SIGALRM StartTime uint64 // The time the process started after system boot in clock ticks (_SYSTEM_CLK_TCK) Vsize uint64 RSS int64 RSSlim uint64 }
func LinuxPidState ¶ added in v0.2.0
func LinuxPidState(pid uint64) (*LinuxProcState, error)
func (*LinuxProcState) IsRunning ¶ added in v0.2.0
func (s *LinuxProcState) IsRunning() bool