io

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2026 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContextReader

func NewContextReader(ctx context.Context, r io.Reader) io.Reader

Types

type MultiWriter

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

MultiWriter is a concurrent safe writer that allows appending/removing writers. Newly appended writers get the last write to preserve last output.

func NewMultiWriter

func NewMultiWriter(bufferSize int, writers ...io.Writer) *MultiWriter

func (*MultiWriter) Append

func (t *MultiWriter) Append(writers ...io.Writer) error

func (*MultiWriter) Remove

func (t *MultiWriter) Remove(writers ...io.Writer)

func (*MultiWriter) Write

func (t *MultiWriter) Write(p []byte) (n int, err error)

type TerminalQueryFilter added in v0.21.0

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

TerminalQueryFilter wraps an io.Writer and filters out terminal query sequences from the output. This prevents queries sent by the host's shell from reaching connected clients, whose terminals would otherwise respond and pollute the PTY input.

Filtered queries include:

  • OSC 10/11/12 queries (foreground/background/cursor color): ESC ] N ; ? BEL/ST
  • CSI 5 n (device status request)
  • CSI 6 n (cursor position request)
  • CSI c / CSI 0 c (primary device attributes)
  • CSI > c / CSI > 0 c (secondary device attributes)
  • CSI = c / CSI = 0 c (tertiary device attributes)

func NewTerminalQueryFilter added in v0.21.0

func NewTerminalQueryFilter(w io.Writer) *TerminalQueryFilter

NewTerminalQueryFilter creates a filter that removes terminal query sequences from output before writing to the underlying writer.

func (*TerminalQueryFilter) Write added in v0.21.0

func (f *TerminalQueryFilter) Write(p []byte) (int, error)

Write filters terminal query sequences from p and writes the result to the underlying writer. Returns len(p) on success to indicate all input bytes were processed. On error, returns 0 because the filtered output is written atomically (all or nothing) and input bytes don't map 1:1 to output bytes due to filtering.

Jump to

Keyboard shortcuts

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