zdpgo_shell

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: MIT Imports: 6 Imported by: 1

README

zdpgo_shell

使用Golang操作shell

版本历史

  • v0.1.1 2022/5/1 新增:跨平台的kill命令
  • v0.1.2 2022/5/16 升级:升级kill命令

Documentation

Index

Constants

View Source
const (
	UTF8    = Charset("UTF-8")
	GB18030 = Charset("GB18030")
)

Variables

This section is empty.

Functions

func ConvertByte2String

func ConvertByte2String(byte []byte, charset Charset) string

func RunCommand

func RunCommand(cmd string) string

func RunCommandWithErr

func RunCommandWithErr(cmd string) (string, error)

func RunWithWait

func RunWithWait(command string) (string, error)

Types

type Charset

type Charset string

type Config

type Config struct {
}

type Shell

type Shell struct {
	Config *Config // 配置对象
}

func New

func New() *Shell

func NewWithConfig

func NewWithConfig(config Config) *Shell

func (*Shell) Kill added in v0.1.1

func (s *Shell) Kill(pid int) string

Kill 终止指定进程

func (*Shell) Run

func (s *Shell) Run(command string) string

Run 阻塞式的执行外部shell命令的函数,等待执行完毕并返回标准输出

func (*Shell) RunWithError

func (s *Shell) RunWithError(command string) (string, error)

RunWithError 运行命令并返回结果和错误

func (*Shell) RunWithWait

func (s *Shell) RunWithWait(command string) (string, error)

RunWithWait 执行命令并等待结果返回,适合ping之类的需要等待一段时间的命令

Directories

Path Synopsis
Package encoding defines an interface for character encodings, such as Shift JIS and Windows 1252, that can convert to and from UTF-8.
Package encoding defines an interface for character encodings, such as Shift JIS and Windows 1252, that can convert to and from UTF-8.
charmap
Package charmap provides simple character encodings such as IBM Code Page 437 and Windows 1252.
Package charmap provides simple character encodings such as IBM Code Page 437 and Windows 1252.
htmlindex
Package htmlindex maps character set encoding names to Encodings as recommended by the W3C for use in HTML 5.
Package htmlindex maps character set encoding names to Encodings as recommended by the W3C for use in HTML 5.
ianaindex
Package ianaindex maps names to Encodings as specified by the IANA registry.
Package ianaindex maps names to Encodings as specified by the IANA registry.
internal
Package internal contains code that is shared among encoding implementations.
Package internal contains code that is shared among encoding implementations.
internal/identifier
Package identifier defines the contract between implementations of Encoding and Index by defining identifiers that uniquely identify standardized coded character sets (CCS) and character encoding schemes (CES), which we will together refer to as encodings, for which Encoding implementations provide converters to and from UTF-8.
Package identifier defines the contract between implementations of Encoding and Index by defining identifiers that uniquely identify standardized coded character sets (CCS) and character encoding schemes (CES), which we will together refer to as encodings, for which Encoding implementations provide converters to and from UTF-8.
simplifiedchinese
Package simplifiedchinese provides Simplified Chinese encodings such as GBK.
Package simplifiedchinese provides Simplified Chinese encodings such as GBK.
traditionalchinese
Package traditionalchinese provides Traditional Chinese encodings such as Big5.
Package traditionalchinese provides Traditional Chinese encodings such as Big5.
unicode
Package unicode provides Unicode encodings such as UTF-16.
Package unicode provides Unicode encodings such as UTF-16.
unicode/utf32
Package utf32 provides the UTF-32 Unicode encoding.
Package utf32 provides the UTF-32 Unicode encoding.
examples
hello command

Jump to

Keyboard shortcuts

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