system

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareOsEnv

func CompareOsEnv(key, comparedEnv string) bool

CompareOsEnv gets env named by the key and compare it with comparedEnv.

func ExecCommand

func ExecCommand(command string, opts ...Option) (stdout, stderr string, err error)

ExecCommand execute command, return the stdout and stderr string of command, and error if error occur param `command` is a complete command string, like, ls -a (linux), dir(windows), ping 127.0.0.1 in linux, use /bin/bash -c to execute command in windows, use powershell.exe to execute command

func GetOsBits

func GetOsBits() int

GetOsBits return current os bits (32 or 64).

func GetOsEnv

func GetOsEnv(key string) string

GetOsEnv gets the value of the environment variable named by the key.

func IsLinux

func IsLinux() bool

IsLinux check if current os is linux.

func IsMac

func IsMac() bool

IsMac check if current os is macos.

func IsWindows

func IsWindows() bool

IsWindows check if current os is windows.

func RemoveOsEnv

func RemoveOsEnv(key string) error

RemoveOsEnv remove a single environment variable.

func SetOsEnv

func SetOsEnv(key, value string) error

SetOsEnv sets the value of the environment variable named by the key.

Types

type Option

type Option func(*exec.Cmd)

func WithForeground

func WithForeground() Option

func WithWinHide

func WithWinHide() Option

Jump to

Keyboard shortcuts

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