Documentation ¶
Index ¶
- func CurrentShell(onlyName bool) (path string)
- func ExecCmd(binName string, args []string, workDir ...string) (string, error)
- func ExecLine(cmdLine string, workDir ...string) (string, error)
- func Executable(binName 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 Hostname() string
- func IsConsole(out io.Writer) bool
- func IsLinux() bool
- func IsMSys() bool
- func IsMac() bool
- func IsShellSpecialVar(c uint8) bool
- func IsTerminal(fd uintptr) bool
- func IsWin() bool
- func IsWindows() bool
- func Kill(pid int, signal syscall.Signal) error
- func LoginUser() *user.User
- func ProcessExists(pid int) bool
- func QuickExec(cmdLine string, workDir ...string) (string, error)
- func ShellExec(cmdLine string, shells ...string) (string, error)
- func StdIsTerminal() bool
- func UHomeDir() string
- func UserCacheDir(subPath string) string
- func UserConfigDir(subPath string) string
- func UserDir(subPath string) string
- func UserHomeDir() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentShell ¶ added in v0.4.1
CurrentShell get current used shell env file. eg "/bin/zsh" "/bin/bash". if onlyName=true, will return "zsh", "bash"
func ExecCmd ¶ added in v0.4.1
ExecCmd an command and return output. Usage:
ExecCmd("ls", []string{"-al"})
func ExpandPath ¶ added in v0.4.1
ExpandPath will parse `~` as user home dir path.
func HasShellEnv ¶ added in v0.4.1
HasShellEnv has shell env check.
Usage:
HasShellEnv("sh") HasShellEnv("bash")
func Hostname ¶ added in v0.4.1
func Hostname() string
Hostname is alias of os.Hostname, but ignore error
func IsConsole ¶ added in v0.4.1
IsConsole check out is in stderr/stdout/stdin
Usage:
sysutil.IsConsole(os.Stdout)
func IsShellSpecialVar ¶ added in v0.4.1
IsShellSpecialVar reports whether the character identifies a special shell variable such as $*.
func UserCacheDir ¶ added in v0.4.1
UserCacheDir will prepend user `$HOME/.cache` to subPath
func UserConfigDir ¶ added in v0.4.1
UserConfigDir will prepend user `$HOME/.config` to subPath
func UserHomeDir ¶ added in v0.4.1
func UserHomeDir() string
UserHomeDir is alias of os.UserHomeDir, but ignore error
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.