Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exec: Consume websocket pings for stderr #1380

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading