Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
More comments
  • Loading branch information
mafredri committed Mar 24, 2023
commit 03a0bb6e9c108107e006991c57b5f72e531995fb
4 changes: 3 additions & 1 deletion agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -1103,14 +1103,14 @@ func (a *agent) handleSSHSession(session ssh.Session) (retErr error) {
}
var wg sync.WaitGroup
defer func() {
defer wg.Wait()
closeErr := ptty.Close()
if closeErr != nil {
a.logger.Warn(ctx, "failed to close tty", slog.Error(closeErr))
if retErr == nil {
retErr = closeErr
}
}
wg.Wait()
}()
go func() {
for win := range windowSize {
Expand All @@ -1127,6 +1127,8 @@ func (a *agent) handleSSHSession(session ssh.Session) (retErr error) {
}()
wg.Add(1)
go func() {
// Ensure data is flushed to session on command exit, if we
// close the session too soon, we might lose data.
defer wg.Done()
_, _ = io.Copy(session, ptty.Output())
}()
Expand Down