Documentation ¶
Index ¶
- Constants
- func CustomSplit(line string, sep string, skipAdjacent bool) (words []string, err error)
- func CustomSplitN(line string, sep string, skipAdjacent bool, n int) (words []string, err error)
- func DisableOOMKiller() error
- func GetExecutable() string
- func LockMemory() error
- func SetProcessPriority(prio int) error
- func ShellEscape(text string) string
- func ShellEscapeAll(list []string) (result []string)
- func ShellSplit(line string) (words []string, err error)
- func ShellSplitN(line string, n int) (words []string, err error)
- func ShellUnescape(text string) (result string, err error)
- func ShellWords(line string) (words []string, err error)
- type AppInfo
- type Command
- type ExecResult
Constants ¶
const ( MCL_CURRENT = 1 /* lock all current mappings */ MCL_FUTURE = 2 /* lock all future mappings */ MCL_ONFAULT = 4 /* lock all pages that are faulted in */ )
Variables ¶
This section is empty.
Functions ¶
func CustomSplit ¶
CustomSplit splits the given string into individual words using the separator runes. Quotes and escapes are handled correctly and will be preserved. If a quote is not closed properly, an error is returned.
func CustomSplitN ¶
CustomSplitN splits the given string into max. n individual words using the separator runes. Quotes and escapes are handled correctly and will be preserved. If a quote is not closed properly, an error is returned.
func DisableOOMKiller ¶
func DisableOOMKiller() error
func GetExecutable ¶
func GetExecutable() string
func LockMemory ¶
func LockMemory() error
func SetProcessPriority ¶
func ShellEscape ¶
ShellEscape escapes the given string for use as an argument in the shell.
func ShellEscapeAll ¶
ShellEscapeAll escapes the given string slice using ShellEscape.
func ShellSplit ¶
ShellSplit splits the given string into individual words just like a shell does while paying attention to quotes and escapes. If quote is not closed properly, an error is returned.
func ShellSplitN ¶
ShellSplit splits the given string into individual words just like a shell does while paying attention to quotes and escapes. If quote is not closed properly, an error is returned.
func ShellWords ¶
ShellWords splits the given string using ShellSplit and unescapes the resulting words. If an error occurs during parsing (e.g., open quotes), parsing will continue and the first error returned.
Types ¶
type AppInfo ¶
type AppInfo struct { Executable string Folder string Name string Description string Version string }
func EnsureAppInfo ¶
func EnsureAppInfo() *AppInfo
func GetAppInfo ¶
type Command ¶
type Command struct { // Path is the path of the command to run. Path string // Args holds command line arguments. Args []string // Env specifies the environment of the process. // If Env is nil, Run uses the current process's environment. Env []string // Dir specifies the working directory of the command. Dir string // Stdin Stdin io.Reader // Stdout Stdout io.Writer // Stderr Stderr io.Writer // Timeout Timeout time.Duration }
func NewCommand ¶
NewCommand returns the Command struct to execute the named program with the given arguments.
func (*Command) Exec ¶
func (c *Command) Exec() (ExecResult, error)
Exec runs the command and returns a struct containing the result or an error if the command could not be executed.
type ExecResult ¶
func Exec ¶
func Exec(cmd string, args ...string) (result ExecResult, err error)
Exec runs the given command with arguments and returns the resulting exit status, stdout and stderr. An error will only be returned if the execution itself fails, not if the command exitted with a non-zero exit status.
func ExecWithEnv ¶
func ExecWithEnv(env []string, cmd string, args ...string) (result ExecResult, err error)
Exec runs the given command with arguments and environment and returns the resulting exit status, stdout and stderr. An error will only be returned if the execution itself fails, not if the command exitted with a non-zero exit status.