Documentation
¶
Overview ¶
Package process provides additional utilities for launching and managing executable processes.
Index ¶
- func ExecutableName(base, goos string) string
- func FindCommand(name string, paths []string) (string, error)
- func IsPOSIXShellCommandNotFound(state *os.ProcessState) bool
- func IsPOSIXShellInvalidCommand(state *os.ProcessState) bool
- func OutputIsWindowsCommandNotFound(output string) bool
- func OutputIsWindowsInvalidCommand(output string) bool
- type Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecutableName ¶
ExecutableName computes the name for an executable for a given base name on a specified operating system.
func FindCommand ¶ added in v0.10.0
FindCommand searches for a command with the specified name within the specified list of directories. It's similar to os/exec.LookPath, except that it allows one to manually specify paths, and it uses a slightly simpler lookup mechanism.
func IsPOSIXShellCommandNotFound ¶ added in v0.10.0
func IsPOSIXShellCommandNotFound(state *os.ProcessState) bool
IsPOSIXShellCommandNotFound returns whether or not a process state represents a "command not found" error from a POSIX shell.
func IsPOSIXShellInvalidCommand ¶ added in v0.10.0
func IsPOSIXShellInvalidCommand(state *os.ProcessState) bool
IsPOSIXShellInvalidCommand returns whether or not a process state represents an "invalid" error from a POSIX shell.
func OutputIsWindowsCommandNotFound ¶ added in v0.10.0
OutputIsWindowsCommandNotFound returns whether or not a process' error output represents a command not found error on Windows.
func OutputIsWindowsInvalidCommand ¶ added in v0.10.0
OutputIsWindowsInvalidCommand returns whether or not a process' error output represents an invalid command error on Windows.
Types ¶
type Stream ¶ added in v0.12.0
type Stream struct {
// contains filtered or unexported fields
}
Stream implements io.ReadWriteCloser around the standard input/output of a process. It is "closed" by terminating the underlying process. It supports an optional "kill delay" which tells the Close method to wait (up to the specified duration) for the process to exit on its own before killing it.
func NewStream ¶ added in v0.12.0
NewStream creates a new stream (io.ReadWriteCloser) by wraping a command object. It must be called before the corresponding process is started, while the resulting stream must only be used after the corresponding process is started. This function will panic if killDelay is negative.
func (*Stream) Close ¶ added in v0.12.0
Close closes the stream by terminating the underlying process and waiting for it to exit. This is the only portable way to unblock input/output streams, as many platforms will block closure of an OS pipe if there are pending read or write operations.
If a non-negative/non-zero kill delay has been specified, then this this method will wait (up to the specified duration) for the process to exit on its own before issuing a kill request. By the time this method returns, the underlying process is guaranteed to no longer be running.
func (*Stream) SetKillDelay ¶ added in v0.12.0
SetKillDelay sets the kill delay for the stream. This function will panic if killDelay is negative. This method is safe to call concurrently with Close, though if called concurrently, there is no guarantee that the new kill delay will be set before Close checks its value.