pty

package
v0.41.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdoptOpts

type AdoptOpts struct {
	ID         string
	Fd         uintptr
	PID        int
	LogPath    string
	MaxLogSize int64
}

type ScreenCapture added in v0.2.0

type ScreenCapture struct {
	Frame         string
	CursorX       int
	CursorY       int
	CursorVisible bool
	Cols          int
	Rows          int
}

type Scrollback

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

func NewScrollback

func NewScrollback(path string, maxSize int64) (*Scrollback, error)

func (*Scrollback) Close

func (s *Scrollback) Close() error

func (*Scrollback) Remove

func (s *Scrollback) Remove() error

func (*Scrollback) Stats added in v0.28.0

func (s *Scrollback) Stats() (written, maxSize int64, saturated bool)

func (*Scrollback) Tail

func (s *Scrollback) Tail(lines int) ([]byte, error)

func (*Scrollback) TailBytes added in v0.6.1

func (s *Scrollback) TailBytes(maxBytes int64) ([]byte, error)

TailBytes returns up to maxBytes from the end of the scrollback file.

func (*Scrollback) Write

func (s *Scrollback) Write(data []byte) (int, error)

type Session

type Session struct {
	ID         string
	Cmd        *exec.Cmd
	Ptmx       *os.File
	Scrollback *Scrollback
	// contains filtered or unexported fields
}

func AdoptSession

func AdoptSession(opts AdoptOpts) (*Session, error)

func NewSession

func NewSession(opts SessionOpts) (*Session, error)

func (*Session) Attach

func (s *Session) Attach(w io.Writer)

func (*Session) Close

func (s *Session) Close()

func (*Session) Detach

func (s *Session) Detach()

func (*Session) DetachWriter

func (s *Session) DetachWriter(w io.Writer)

func (*Session) Done

func (s *Session) Done() <-chan struct{}

func (*Session) ExitCode

func (s *Session) ExitCode() int

func (*Session) Exited

func (s *Session) Exited() bool

func (*Session) Fd

func (s *Session) Fd() uintptr

func (*Session) ForceKill

func (s *Session) ForceKill() error

func (*Session) Kill

func (s *Session) Kill() error

func (*Session) LastOutputAt added in v0.3.0

func (s *Session) LastOutputAt() time.Time

func (*Session) Poke added in v0.16.5

func (s *Session) Poke()

Poke sends SIGWINCH to the session's process group. This interrupts blocked reads and forces TUI frameworks to re-check stdin, ensuring recently written input is consumed. The child process was started with Setsid, so its PID equals its process group ID.

func (*Session) ProcessPID

func (s *Session) ProcessPID() int

func (*Session) RecentlyAdopted added in v0.6.1

func (s *Session) RecentlyAdopted(grace time.Duration) bool

RecentlyAdopted returns true if the session was adopted (daemon restart) within the last duration and has not yet received fresh PTY output.

func (*Session) Resize

func (s *Session) Resize(rows, cols uint16) error

func (*Session) ScreenPreview added in v0.2.0

func (s *Session) ScreenPreview() string

func (*Session) ScreenSnapshot added in v0.2.0

func (s *Session) ScreenSnapshot() ScreenCapture

func (*Session) WriteInput

func (s *Session) WriteInput(data []byte) error

func (*Session) WriteInputAndSubmit added in v0.29.0

func (s *Session) WriteInputAndSubmit(data []byte) error

WriteInputAndSubmit writes text followed by a carriage return, with a brief pause between the two so that TUI frameworks treat them as separate events. The entire operation holds writeMu to prevent interleaving from other sources.

type SessionOpts

type SessionOpts struct {
	ID         string
	Command    string
	Args       []string
	Dir        string
	Env        map[string]string
	Rows, Cols uint16
	LogPath    string
	MaxLogSize int64
}

Jump to

Keyboard shortcuts

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