package main import ( "golang.org/x/crypto/ssh" "golang.org/x/term" "log" "os" "os/signal" "syscall" ) func handleWindowChange(session *ssh.Session, fd int) { sigwinchCh := make(chan os.Signal, 1) signal.Notify(sigwinchCh, syscall.SIGWINCH) for range sigwinchCh { width, height, err := term.GetSize(fd) if err != nil { log.Printf("Failed to get window size: %v\n", err) continue } if err := session.WindowChange(height, width); err != nil { log.Printf("Failed to send window change request: %v\n", err) } } }