terminalrunner

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2025 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrCloseReq  error = errors.New("received close order")
	ErrPipeWrite error = errors.New("could not write pty->pipe")
	ErrPipeRead  error = errors.New("could not read pipe->pipe")
)
View Source
var (
	ErrTerminalRead  error = errors.New("could not read pipe->pty")
	ErrTerminalWrite error = errors.New("could not write pty->pipe")
)

Functions

This section is empty.

Types

type DynamicMultiWriter

type DynamicMultiWriter struct {
	// contains filtered or unexported fields
}

func NewDynamicMultiWriter

func NewDynamicMultiWriter(logger *slog.Logger, writers ...io.Writer) *DynamicMultiWriter

func (*DynamicMultiWriter) Add

func (dmw *DynamicMultiWriter) Add(w io.Writer)

func (*DynamicMultiWriter) Remove

func (dmw *DynamicMultiWriter) Remove(w io.Writer)

func (*DynamicMultiWriter) Write

func (dmw *DynamicMultiWriter) Write(p []byte) (int, error)

type Event

type Event struct {
	ID    api.ID
	Type  EventType
	Bytes int   // for EvData
	Err   error // for EvClosed/EvError
	When  time.Time
}

type EventType

type EventType int
const (
	EvError EventType = iota // abnormal error
	EvCmdExited
)

type Exec

type Exec struct {
	// contains filtered or unexported fields
}

func (*Exec) Attach

func (sr *Exec) Attach(supervisorID *api.ID, response *api.ResponseWithFD) error

func (*Exec) Close

func (sr *Exec) Close(reason error) error

func (*Exec) CreateMetadata

func (sr *Exec) CreateMetadata() error

func (*Exec) CreateNewClient

func (sr *Exec) CreateNewClient(supervisorID *api.ID) (int, error)

func (*Exec) Detach

func (sr *Exec) Detach(id *api.ID) error

func (*Exec) ID

func (sr *Exec) ID() api.ID

func (*Exec) Metadata

func (sr *Exec) Metadata() (*api.TerminalDoc, error)

func (*Exec) OnInitShell

func (sr *Exec) OnInitShell() error

func (*Exec) OpenSocketCtrl

func (sr *Exec) OpenSocketCtrl() error

func (*Exec) PostAttachShell

func (sr *Exec) PostAttachShell() error

func (*Exec) Resize

func (sr *Exec) Resize(args api.ResizeArgs)

func (*Exec) SetupShell

func (sr *Exec) SetupShell() error

func (*Exec) StartServer

func (sr *Exec) StartServer(
	_ context.Context,
	sc *terminalrpc.TerminalControllerRPC,
	readyCh chan error,
	doneCh chan error,
)

func (*Exec) StartTerminal

func (sr *Exec) StartTerminal(evCh chan<- Event) error

func (*Exec) Write

func (sr *Exec) Write(p []byte) (int, error)

type TerminalRunner

type TerminalRunner interface {
	OpenSocketCtrl() error
	StartServer(ctx context.Context, sc *terminalrpc.TerminalControllerRPC, readyCh chan error, doneCh chan error)
	StartTerminal(evCh chan<- Event) error
	ID() api.ID
	Close(reason error) error
	Resize(args api.ResizeArgs)
	CreateMetadata() error
	Detach(id *api.ID) error
	Attach(id *api.ID, response *api.ResponseWithFD) error
	SetupShell() error
	OnInitShell() error
	PostAttachShell() error
	Metadata() (*api.TerminalDoc, error)
}

func NewTerminalRunnerExec

func NewTerminalRunnerExec(ctx context.Context, logger *slog.Logger, spec *api.TerminalSpec) TerminalRunner

func NewTerminalRunnerTest

func NewTerminalRunnerTest(_ context.Context) TerminalRunner

type Test

type Test struct {
	OpenSocketCtrlFunc  func() error
	StartServerFunc     func(ctx context.Context, sc *terminalrpc.TerminalControllerRPC, readyCh chan error, doneCh chan error)
	StartTerminalFunc   func(evCh chan<- Event) error
	CloseFunc           func(reason error) error
	ResizeFunc          func(args api.ResizeArgs)
	IDFunc              func() api.ID
	CreateMetadataFunc  func() error
	AttachFunc          func(id *api.ID, response *api.ResponseWithFD) error
	DetachFunc          func(id *api.ID) error
	SetupShellFunc      func() error
	OnInitShellFunc     func() error
	MetadataFunc        func() (*api.TerminalDoc, error)
	PostAttachShellFunc func() error
	// contains filtered or unexported fields
}

func (*Test) Attach

func (sr *Test) Attach(id *api.ID, response *api.ResponseWithFD) error

func (*Test) Close

func (sr *Test) Close(reason error) error

func (*Test) CreateMetadata

func (sr *Test) CreateMetadata() error

func (*Test) Detach

func (sr *Test) Detach(id *api.ID) error

func (*Test) ID

func (sr *Test) ID() api.ID

func (*Test) Metadata

func (sr *Test) Metadata() (*api.TerminalDoc, error)

func (*Test) OnInitShell

func (sr *Test) OnInitShell() error

func (*Test) OpenSocketCtrl

func (sr *Test) OpenSocketCtrl() error

func (*Test) PostAttachShell

func (sr *Test) PostAttachShell() error

func (*Test) Resize

func (sr *Test) Resize(args api.ResizeArgs)

func (*Test) SetupShell

func (sr *Test) SetupShell() error

func (*Test) StartServer

func (sr *Test) StartServer(
	ctx context.Context,
	sc *terminalrpc.TerminalControllerRPC,
	readyCh chan error,
	doneCh chan error,
)

func (*Test) StartTerminal

func (sr *Test) StartTerminal(evCh chan<- Event) error

Jump to

Keyboard shortcuts

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