shellsession

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package shellsession starts shell session.

Index

Constants

View Source
const (
	// ResizeSleepInterval defines the interval between terminal size checks.
	ResizeSleepInterval = time.Millisecond * 500

	// StdinBufferLimit defines the maximum size of the standard input buffer.
	StdinBufferLimit = 1024
)

Variables

View Source
var ErrZeroWidthOrHeight = errors.New("terminal width or height is zero")

ErrZeroWidthOrHeight is returned when the terminal width or height is zero.

Functions

This section is empty.

Types

type ShellSession

type ShellSession struct {

	// SizeData is used to store size data at session level to compare with new size.
	SizeData message.SizeData
	// contains filtered or unexported fields
}

ShellSession represents a shell session that handles terminal interactions.

func NewShellSession

func NewShellSession(logger log.T, sess session.ISessionSupport) (*ShellSession, error)

NewShellSession creates a new shell session.

func (*ShellSession) HandleControlSignals added in v0.2.0

func (s *ShellSession) HandleControlSignals(ctx context.Context) error

HandleControlSignals handles control signals when given by user.

func (*ShellSession) Name

func (s *ShellSession) Name() string

Name is the session name used in the plugin.

func (*ShellSession) ProcessStreamMessagePayload

func (s *ShellSession) ProcessStreamMessagePayload(outputMessage message.ClientMessage) (bool, error)

ProcessStreamMessagePayload prints payload received on datachannel to console.

func (*ShellSession) SetSessionHandlers

func (s *ShellSession) SetSessionHandlers(ctx context.Context) (err error)

SetSessionHandlers sets up handlers for terminal input, resizing, and control signals.

func (*ShellSession) Stop

func (s *ShellSession) Stop() error

Stop restores the terminal settings and exits.

type TerminalSizer

type TerminalSizer = func(fd int) (width, height int, err error)

TerminalSizer is a function type that retrieves the size of the terminal.

Jump to

Keyboard shortcuts

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