fix(agent): Close stdin and stdout separately to fix pty output loss (#6862)

Fixes #6656
Closes #6840
This commit is contained in:
Mathias Fredriksson
2023-03-29 21:58:38 +03:00
committed by GitHub
parent 349bfad2e9
commit 90d18dd2e5
5 changed files with 61 additions and 29 deletions

View File

@ -6,8 +6,12 @@ import (
"os"
"github.com/gliderlabs/ssh"
"golang.org/x/xerrors"
)
// ErrClosed is returned when a PTY is used after it has been closed.
var ErrClosed = xerrors.New("pty: closed")
// PTY is a minimal interface for interacting with a TTY.
type PTY interface {
io.Closer
@ -31,6 +35,11 @@ type PTY interface {
// The same stream would be used to provide user input: pty.Input().Write(...)
Input() ReadWriter
// Dup returns a new file descriptor for the PTY.
//
// This is useful for closing stdin and stdout separately.
Dup() (*os.File, error)
// Resize sets the size of the PTY.
Resize(height uint16, width uint16) error
}