Documentation ¶
Overview ¶
exec is extension of the standard os.exec package. Adds a handy dandy interface and assorted other features.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // for equivalence with os/exec ErrNotFound = exec.ErrNotFound LookPath = exec.LookPath )
Functions ¶
func IsCmdNotFound ¶ added in v0.2.0
IsCmdNotFound reports true if the underlying error was exec.ErrNotFound.
func MaybeExec ¶
func MaybeExec()
MaybeExec should be called at the start of the program, if the process argv[0] is a name registered with multicall, the related function will be executed. If the functions returns an error, it will be printed to stderr and will exit with an exit status of 1, otherwise it will exit with a 0 exit status.
Types ¶
type Cmd ¶
type Cmd interface { // Methods provided by exec.Cmd CombinedOutput() ([]byte, error) Output() ([]byte, error) Run() error Start() error StderrPipe() (io.ReadCloser, error) StdinPipe() (io.WriteCloser, error) StdoutPipe() (io.ReadCloser, error) Wait() error // Simplified wrapper for Process.Kill + Wait Kill() error // Simplified wrapper for Process.Pid Pid() int }
An exec.Cmd compatible interface.
type Entrypoint ¶
type Entrypoint string
Entrypoint provides the access to a multicall command.
func NewEntrypoint ¶
func NewEntrypoint(name string, fn entrypointFn) Entrypoint
NewEntrypoint adds a new multicall command. name is the command name and fn is the function that will be executed for the specified command. It returns the related Entrypoint. Packages adding new multicall commands should call Add in their init function.
func (Entrypoint) Command ¶
func (e Entrypoint) Command(args ...string) *ExecCmd
Command will prepare the *ExecCmd for the given entrypoint, configured with the provided args.
func (Entrypoint) Sudo ¶
func (e Entrypoint) Sudo(args ...string) *ExecCmd
Sudo will prepare the *ExecCmd for the given entrypoint to be run as root via sudo with the provided args.