sysutil

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2019 License: MIT Imports: 6 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 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

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