mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-10-18 04:43:12 +02:00
orchard ssh vm: prevent busy loop in remote terminal resize goroutine (#297)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user