Documentation
¶
Index ¶
- type ClientRunner
- type Event
- type EventType
- type Exec
- func (sr *Exec) Attach(terminal *api.AttachedTerminal) error
- func (sr *Exec) Close(_ error) error
- func (sr *Exec) CreateMetadata() error
- func (sr *Exec) Detach() error
- func (sr *Exec) ID() api.ID
- func (sr *Exec) Metadata() (*api.ClientDoc, error)
- func (sr *Exec) OpenSocketCtrl() error
- func (sr *Exec) Resize(_ api.ResizeArgs)
- func (sr *Exec) StartServer(ctx context.Context, sc *clientrpc.ClientControllerRPC, readyCh chan error, ...)
- func (sr *Exec) StartTerminalCmd(terminal *api.AttachedTerminal) error
- func (sr *Exec) State() (*api.ClientStatusMode, error)
- func (sr *Exec) WaitClose(_ error) error
- type Test
- func (t *Test) Attach(terminal *api.AttachedTerminal) error
- func (t *Test) Close(reason error) error
- func (t *Test) CreateMetadata() error
- func (t *Test) Detach() error
- func (t *Test) ID() api.ID
- func (t *Test) Metadata() (*api.ClientDoc, error)
- func (t *Test) OpenSocketCtrl() error
- func (t *Test) Resize(args api.ResizeArgs)
- func (t *Test) StartServer(ctx context.Context, sc *clientrpc.ClientControllerRPC, readyCh chan error, ...)
- func (t *Test) StartTerminalCmd(terminal *api.AttachedTerminal) error
- func (t *Test) State() (*api.ClientStatusMode, error)
- type UIMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientRunner ¶
type ClientRunner interface {
OpenSocketCtrl() error
StartServer(ctx context.Context, sc *clientrpc.ClientControllerRPC, readyCh chan error, doneCh chan error)
Attach(terminal *api.AttachedTerminal) error
ID() api.ID
Close(reason error) error
Resize(args api.ResizeArgs)
CreateMetadata() error
Detach() error
StartTerminalCmd(terminal *api.AttachedTerminal) error
Metadata() (*api.ClientDoc, error)
State() (*api.ClientStatusMode, error)
}
func NewClientRunnerExec ¶
func NewClientRunnerExecWithIO ¶ added in v0.8.0
func NewClientRunnerExecWithIO( ctx context.Context, logger *slog.Logger, doc *api.ClientDoc, evCh chan<- Event, stdin, stdout, stderr *os.File, ) ClientRunner
NewClientRunnerExecWithIO is like NewClientRunnerExec but lets the caller plug in custom stdin/stdout/stderr handles instead of the process's own. A nil handle falls back to the corresponding os.Std*.
type Exec ¶
type Exec struct {
Mgr *terminalstore.Exec
// contains filtered or unexported fields
}
func (*Exec) CreateMetadata ¶
func (*Exec) Metadata ¶ added in v0.8.0
Metadata returns a snapshot of the runner's ClientDoc. The returned pointer is a deep copy — callers may freely mutate it without racing the runner's own metadata writes.
func (*Exec) OpenSocketCtrl ¶
func (*Exec) Resize ¶
func (sr *Exec) Resize(_ api.ResizeArgs)
func (*Exec) StartServer ¶
func (*Exec) StartTerminalCmd ¶
func (sr *Exec) StartTerminalCmd(terminal *api.AttachedTerminal) error
type Test ¶
type Test struct {
Ctx context.Context
Logger *slog.Logger
// Last-call trackers
LastListener net.Listener
LastController *clientrpc.ClientControllerRPC
LastCtx context.Context
LastReason error
LastResize api.ResizeArgs
// Stub functions
OpenSocketCtrlFunc func() error
StartServerFunc func(
ctx context.Context,
sc *clientrpc.ClientControllerRPC,
readyCh chan error,
doneCh chan error,
)
IDFunc func() api.ID
CloseFunc func(reason error) error
ResizeFunc func(args api.ResizeArgs)
AttachFunc func(terminal *api.AttachedTerminal) error
CreateMetadataFunc func() error
DetachFunc func() error
StartTerminalCmdFunc func(terminal *api.AttachedTerminal) error
MetadataFunc func() (*api.ClientDoc, error)
StateFunc func() (*api.ClientStatusMode, error)
}
Test is a test double for ClientRunner It allows overriding behavior with function fields and capturing arguments for assertions in unit tests.
func NewClientRunnerTest ¶
NewClientRunnerTest returns a new ClientRunnerTest instance.
func (*Test) CreateMetadata ¶
func (*Test) OpenSocketCtrl ¶
func (*Test) Resize ¶
func (t *Test) Resize(args api.ResizeArgs)
func (*Test) StartServer ¶
func (*Test) StartTerminalCmd ¶
func (t *Test) StartTerminalCmd(terminal *api.AttachedTerminal) error
Click to show internal directories.
Click to hide internal directories.