sysutil

package
v0.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 29, 2020 License: MIT Imports: 9 Imported by: 32

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentShell added in v0.1.4

func CurrentShell(onlyName bool) (path string)

CurrentShell get current used shell env file. eg "/bin/zsh" "/bin/bash"

func ExecCmd added in v0.1.4

func ExecCmd(binName string, args []string, workDir ...string) (string, error)

ExecCmd an command and return output. Usage:

ExecCmd("ls", []string{"-al"})

func HasShellEnv added in v0.1.4

func HasShellEnv(shell string) bool

HasShellEnv has shell env check. Usage:

HasShellEnv("sh")
HasShellEnv("bash")

func IsConsole added in v0.2.2

func IsConsole(out io.Writer) bool

IsConsole check out is in stderr/stdout/stdin

func IsLinux added in v0.2.2

func IsLinux() bool

IsLinux system

func IsMSys added in v0.2.2

func IsMSys() bool

IsMSys msys(MINGW64) env,不一定支持颜色

func IsMac added in v0.2.2

func IsMac() bool

IsMac system

func IsWin added in v0.2.2

func IsWin() bool

IsWin system. linux windows darwin

func IsWindows added in v0.2.3

func IsWindows() bool

IsWindows system. linux windows darwin

func Kill

func Kill(pid int, signal syscall.Signal) error

Kill process by pid

func ProcessExists

func ProcessExists(pid int) bool

ProcessExists check process exists by pid

func QuickExec added in v0.1.4

func QuickExec(cmdLine string, workDir ...string) (string, error)

QuickExec quick exec an simple command line Usage:

QuickExec("git status")

func ShellExec added in v0.1.4

func ShellExec(cmdStr string, shells ...string) (string, error)

ShellExec exec command by shell cmdStr eg. "ls -al"

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL