sysutil

package
v0.0.0-...-754e97a Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrentShell

func CurrentShell(onlyName bool) (path string)

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

func ExecCmd

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

ExecCmd an command and return output. Usage:

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

func HasShellEnv

func HasShellEnv(shell string) bool

HasShellEnv has shell env check. Usage:

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

func IsConsole

func IsConsole(out io.Writer) bool

IsConsole check out is in stderr/stdout/stdin

func IsLinux

func IsLinux() bool

IsLinux system

func IsMSys

func IsMSys() bool

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

func IsMac

func IsMac() bool

IsMac system

func IsWin

func IsWin() bool

IsWin system. linux windows darwin

func IsWindows

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

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

QuickExec quick exec an simple command line Usage:

QuickExec("git status")

func ShellExec

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