terminal

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SplitCommandStr = "InBugW_H_A_Z"
	CommandEndStr   = "========InBugCommandRunEnd========"
)

Variables

View Source
var (
	DefaultTerminalConfig = &TerminalConfig{
		BufferSize: 1024 * 4,
	}
)

Functions

func GetProcessChildren

func GetProcessChildren(ppid int) ([]*process.Process, error)

Types

type ITerminal

type ITerminal interface {
	Exec(command string, isWaitInput ...bool) error
	Terminate() error
	Close() error
	GetID() string
	SetID(id string)
}

func NewTerminal

func NewTerminal(handleMsg func(id string, msgBytes []byte), terminalConfig ...*TerminalConfig) ITerminal

type LinuxTerminal

type LinuxTerminal struct {
	Terminal
}

func NewLinuxTerminal

func NewLinuxTerminal(handleMsg func(id string, msgBytes []byte), terminalConfig *TerminalConfig, terminalId ...string) *LinuxTerminal

type Terminal

type Terminal struct {
	ID  string
	PID int

	Shell *exec.Cmd

	TerminateFun func() error

	IsRun bool
	// contains filtered or unexported fields
}

func (*Terminal) Close

func (b *Terminal) Close() error

func (*Terminal) Exec

func (b *Terminal) Exec(command string, isWaitInput ...bool) error

func (*Terminal) GetID

func (b *Terminal) GetID() string

func (*Terminal) SetID

func (b *Terminal) SetID(id string)

func (*Terminal) Terminate

func (b *Terminal) Terminate() error

type TerminalConfig

type TerminalConfig struct {
	BufferSize int32
}

type TerminalManagerStruct

type TerminalManagerStruct struct {
	Terminals map[string]ITerminal
}

func GetTerminalManager

func GetTerminalManager() *TerminalManagerStruct

func (*TerminalManagerStruct) CloseAll

func (b *TerminalManagerStruct) CloseAll() bool

func (*TerminalManagerStruct) Exec

func (b *TerminalManagerStruct) Exec(id string, command string) error

func (*TerminalManagerStruct) Get

func (*TerminalManagerStruct) GetAll

func (b *TerminalManagerStruct) GetAll() map[string]ITerminal

type WindowsTerminal

type WindowsTerminal struct {
	Terminal
}

func NewWindowsTerminal

func NewWindowsTerminal(handleMsg func(id string, msgBytes []byte), terminalConfig *TerminalConfig, terminalId ...string) *WindowsTerminal

Jump to

Keyboard shortcuts

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