Skip to content

Commit

Permalink
fix: stack trace exiting interactive console (#2786)
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas authored Sep 23, 2024
1 parent 164cb5b commit 06a05f5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions internal/console/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ func NewStatusManager(ctx context.Context) StatusManager {
}()

go func() {
defer sm.exitWait.Done()
current := ""
closed := false
for {

buf := bytes.Buffer{}
Expand All @@ -130,6 +130,9 @@ func NewStatusManager(ctx context.Context) StatusManager {
if current != "" {
sm.writeLine(current)
}
if !closed {
sm.exitWait.Done()
}
return
}
buf.Write(rawData[:n])
Expand All @@ -140,7 +143,10 @@ func NewStatusManager(ctx context.Context) StatusManager {
// we keep running though as there may be more data on exit
// that we handle on a best effort basis
sm.writeLine(current)
sm.exitWait.Done()
if !closed {
sm.exitWait.Done()
closed = true
}
continue
}
if err != nil {
Expand Down

0 comments on commit 06a05f5

Please sign in to comment.