mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
This was causing the TTY to be real wonky on Windows. It didn't seem to have an effect on Linux, but I suspect that's because of escape codes.
40 lines
796 B
Go
40 lines
796 B
Go
package pty
|
|
|
|
import (
|
|
"io"
|
|
)
|
|
|
|
// PTY is a minimal interface for interacting with a TTY.
|
|
type PTY interface {
|
|
io.Closer
|
|
|
|
// Output handles TTY output.
|
|
//
|
|
// cmd.SetOutput(pty.Output()) would be used to specify a command
|
|
// uses the output stream for writing.
|
|
//
|
|
// The same stream could be read to validate output.
|
|
Output() io.ReadWriter
|
|
|
|
// Input handles TTY input.
|
|
//
|
|
// cmd.SetInput(pty.Input()) would be used to specify a command
|
|
// uses the PTY input for reading.
|
|
//
|
|
// The same stream would be used to provide user input: pty.Input().Write(...)
|
|
Input() io.ReadWriter
|
|
|
|
// Resize sets the size of the PTY.
|
|
Resize(height uint16, width uint16) error
|
|
}
|
|
|
|
// New constructs a new Pty.
|
|
func New() (PTY, error) {
|
|
return newPty()
|
|
}
|
|
|
|
type readWriter struct {
|
|
io.Reader
|
|
io.Writer
|
|
}
|