Documentation ¶
Index ¶
- func CurrentShell(onlyName bool) (path string)
- func ExecCmd(binName string, args []string, workDir ...string) (string, error)
- func ExpandPath(path string) string
- func FindExecutable(binName string) (string, error)
- func HasExecutable(binName string) bool
- func HasShellEnv(shell string) bool
- func HomeDir() string
- func IsConsole(out io.Writer) bool
- func IsLinux() bool
- func IsMSys() bool
- func IsMac() bool
- func IsTerminal(fd uintptr) bool
- func IsWin() bool
- func IsWindows() bool
- func Kill(pid int, signal syscall.Signal) error
- func ProcessExists(pid int) bool
- func QuickExec(cmdLine string, workDir ...string) (string, error)
- func ShellExec(cmdStr string, shells ...string) (string, error)
- func StdIsTerminal() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentShell ¶ added in v0.1.4
CurrentShell get current used shell env file. eg "/bin/zsh" "/bin/bash". if onlyName=true, will return "zsh", "bash"
func ExecCmd ¶ added in v0.1.4
ExecCmd an command and return output. Usage:
ExecCmd("ls", []string{"-al"})
func ExpandPath ¶ added in v0.3.9
ExpandPath will parse `~` as user home dir path.
func HasShellEnv ¶ added in v0.1.4
HasShellEnv has shell env check.
Usage:
HasShellEnv("sh") HasShellEnv("bash")
func IsConsole ¶ added in v0.2.2
IsConsole check out is in stderr/stdout/stdin
Usage:
sysutil.IsConsole(os.Stdout)
func QuickExec ¶ added in v0.1.4
QuickExec quick exec an simple command line Usage:
QuickExec("git status")
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.