Skip to content

Commit

Permalink
Merge pull request #1380 from stefanor/stderr-websocket-pings
Browse files Browse the repository at this point in the history
exec: Consume websocket pings for stderr
  • Loading branch information
stgraber authored Nov 16, 2024
2 parents 795717f + d098f46 commit ce639bb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/incusd/instance_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,15 @@ func (s *execWs) Do(op *operations.Operation) error {
}()
}

if i == execWSStderr {
// Consume data (e.g. websocket pings) from stderr too to
// avoid a situation where we hit an inactivity timeout on
// stderr during long exec sessions
go func() {
_, _, _ = conn.ReadMessage()
}()
}

if i == execWSStdin {
err = <-ws.MirrorWrite(conn, ttys[i])
_ = ttys[i].Close()
Expand Down

0 comments on commit ce639bb

Please sign in to comment.