orchard ssh vm: prevent busy loop in remote terminal resize goroutine (#297)

This commit is contained in:
Nikolay Edigaryev
2025-04-02 14:07:52 +00:00
committed by GitHub
parent f4a12b073a
commit 599ac40a90
+7 -2
View File
@@ -132,6 +132,13 @@ func runSSHVM(cmd *cobra.Command, args []string) error {
// Periodically adjust remote terminal size
go func() {
for {
select {
case <-time.After(time.Second * time.Duration(wait)):
// Proceed with adjusting the remote terminal size
case <-cmd.Context().Done():
return
}
newWidth, newHeight, err := term.GetSize(stdoutFD)
if err != nil {
return
@@ -147,8 +154,6 @@ func runSSHVM(cmd *cobra.Command, args []string) error {
height = newHeight
width = newWidth
time.Sleep(time.Second)
}
}()