elsys

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvUsername

func EnvUsername() (string, error)

EnvUsername returns the username from the OS environment.

func ExecCmd

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

ExecCmd an command and return output. Usage:

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

func Exists

func Exists(pid int) bool

Exists check process running by given pid

func Exit

func Exit(code int, info string, err error)

Exit system with additional information.

func ForceGC

func ForceGC()

run garbage collection manually (blocking).

func ForceGCNonBlocking

func ForceGCNonBlocking()

run garbage collection manually (non-blocking).

func GetDiskUsage

func GetDiskUsage(path string) (used, free, total uint64)

GetDiskUsage returns the disk usage of given path as bytes.

func GetMemoryUsage

func GetMemoryUsage() uint64

GetMemoryUsage returns the size of memory used by this program as bytes.

func Input

func Input(s ...string) (string, error)

Input read one line from user input. Usage:

in := Input()
ans, _ := Input("your name?")

func InputPassword

func InputPassword(s ...string) string

InputPassword from console terminal

func IsCentOS

func IsCentOS() bool

If running on CentOS, return true.

func IsCentOS8

func IsCentOS8() bool

If running on CentOS 8, return true.

func IsFreeBSD

func IsFreeBSD() bool

If running on freebsd, return true.

func IsLinux

func IsLinux() bool

If running on linux, return true.

func IsMac

func IsMac() bool

If running on mac, return true.

func IsRHEL

func IsRHEL() bool

If running on Red Hat Enterprise Linux, return true.

func IsRHEL8

func IsRHEL8() bool

If running on Red Hat Enterprise Linux 8, return true.

func IsRHELLike

func IsRHELLike() bool

If running on linux that based on RHEL, return true.

func IsUnixLike

func IsUnixLike() bool

If running on unix-like system, return true.

func IsWin

func IsWin() bool

If running on windows, return true.

func Kill

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

Kill process by pid

func OSUsername

func OSUsername() (string, error)

OSUsername returns the username of the current OS user (based on UID).

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.

Jump to

Keyboard shortcuts

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