Remote Pty Resize (#123)

fix: set SIGWINCH on remote pty blocks
This commit is contained in:
Sylvie Crowe 2024-07-18 16:56:00 -07:00 committed by GitHub
parent c47e17903d
commit f0263865bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View File

@ -346,8 +346,11 @@ func (bc *BlockController) DoRunShellCommand(rc *RunShellOpts, blockMeta map[str
if err != nil {
log.Printf("error setting term size: %v\n", err)
}
err = bc.ShellProc.Cmd.SetSize(ic.TermSize.Rows, ic.TermSize.Cols)
if err != nil {
log.Printf("error setting remote SIGWINCH: %v\n", err)
}
}
// TODO signals
}
}()
go func() {

View File

@ -15,6 +15,7 @@ type ConnInterface interface {
StdinPipe() (io.WriteCloser, error)
StdoutPipe() (io.ReadCloser, error)
StderrPipe() (io.ReadCloser, error)
SetSize(w int, h int) error
}
type CmdWrap struct {
@ -52,6 +53,10 @@ func (cw CmdWrap) StderrPipe() (io.ReadCloser, error) {
return cw.Cmd.StderrPipe()
}
func (cw CmdWrap) SetSize(w int, h int) error {
return nil
}
type SessionWrap struct {
Session *ssh.Session
StartCmd string
@ -90,3 +95,7 @@ func (sw SessionWrap) StderrPipe() (io.ReadCloser, error) {
}
return io.NopCloser(stderrReader), nil
}
func (sw SessionWrap) SetSize(h int, w int) error {
return sw.Session.WindowChange(h, w)
}