shell

package
v0.0.0-...-cb352a8 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 12 Imported by: 2

Documentation

Index

Constants

View Source
const DAEMON_NO = "--run"
View Source
const DAEMON_WORK_NAME = "--work"

Variables

This section is empty.

Functions

func Kill

func Kill(pid2Name interface{}) error

func KillName

func KillName(name string) error

func KillPid

func KillPid(pid int) error

func OpenErrorFile

func OpenErrorFile(filename string) *os.File

func RunProcess

func RunProcess(cmd interface{}, stdin *os.File, stdout *os.File, stderr *os.File, env []string, opt map[string]interface{}) (*os.Process, error)

func ShowDebugConsole

func ShowDebugConsole() *os.File

func System

func System(cmdArg interface{}, env []string, stdout, stderr io.Writer, stdin io.Reader) (syscall.WaitStatus, error)

cmdArg: string or []string

Types

type ProcessOpt

type ProcessOpt struct {
	Stdin         bool
	Stdout        bool
	Stderr        bool
	CreationFlags int  //window cmd CreationFlags
	HideWindow    bool //windows

	StdinReader io.ReadWriteCloser
	WorkPath    string
}

type Shell

type Shell struct {
	Stdin  io.WriteCloser
	Stdout io.ReadCloser
	// contains filtered or unexported fields
}

func NewProcess

func NewProcess(commandName string, params []string, env []string, opt *ProcessOpt) (*Shell, error)

func POpen

func POpen(commandName string, params []string, env []string, opt *ProcessOpt) (*Shell, error)

func POpen2

func POpen2(cmdStr string, opt *ProcessOpt) (*Shell, error)

func Run

func Run(cmdStr string) (*Shell, error)

func (*Shell) GetCmd

func (me *Shell) GetCmd() *exec.Cmd

func (*Shell) GetPid

func (me *Shell) GetPid() int

func (*Shell) IsClosed

func (me *Shell) IsClosed() bool

func (*Shell) PCheck

func (me *Shell) PCheck(sec int)

func (*Shell) PClose

func (me *Shell) PClose() syscall.WaitStatus

func (*Shell) PRead

func (me *Shell) PRead(b []byte) (int, error)

func (*Shell) PReadLine

func (me *Shell) PReadLine() (string, error)

func (*Shell) PReadLineStdErr

func (me *Shell) PReadLineStdErr() (string, error)

func (*Shell) PReadStdErr

func (me *Shell) PReadStdErr(b []byte) (int, error)

func (*Shell) PWrite

func (me *Shell) PWrite(p []byte) (int, error)

func (*Shell) SetAutoClose

func (me *Shell) SetAutoClose(v bool)

func (*Shell) Signal

func (me *Shell) Signal(sig os.Signal, pid ...int)

func (*Shell) Start

func (me *Shell) Start() error

Jump to

Keyboard shortcuts

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