Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
Name string
// the executable
Exe string
// args passed to executable
Args []string
// the command is run in a shell, that is prepend `/bin/sh -c` or `cmd /C` to the command line
CommandLine string
WorkingDir string
// only for *nix: if not set, runcmd uses env[$SHELL] or defaults to /bin/sh
ForceShell string
// custom environment variables. these are overwritten from .env file if UseEnv is true
Env Env
// only for *nix: if true .profile file in the working dir is sourced
UseProfile bool // dovrebbe essere Profile string : path
// only for *nix: if true .env file in the working dir is used to initialize env vars
UseEnv bool // dovrebbe essere EnvFile string: path
// used only if command is started as process
Logfile string
// the underlying process
Process *os.Process
// contains filtered or unexported fields
}
Command is the launched command, it wraps the process.
func (*Command) FullCommand ¶
FullCommand returns the full command line string.
func (*Command) GetLogfile ¶
GetLogfile get the full path to the file containing the process output.
func (*Command) Run ¶
func (c *Command) Run() *ExecResult
Run starts the specified command and waits for it to complete.
type ExecResult ¶
type ExecResult struct {
// contains filtered or unexported fields
}
ExecResult is the result of the completed command execution.
func (*ExecResult) Error ¶
func (r *ExecResult) Error() error
func (*ExecResult) ExitStatus ¶
func (r *ExecResult) ExitStatus() int
ExitStatus is the command exit.
func (*ExecResult) Stderr ¶
func (r *ExecResult) Stderr() *bytes.Buffer
Stderr returns the underlying buffer with the contents of the error stream.
func (*ExecResult) Stdout ¶
func (r *ExecResult) Stdout() *bytes.Buffer
Stdout returns the underlying buffer with the contents of the output stream.
func (*ExecResult) String ¶
func (r *ExecResult) String() string
func (*ExecResult) Success ¶
func (r *ExecResult) Success() bool
Success true if command completed with no error.
Click to show internal directories.
Click to hide internal directories.