Skip to content

Commit

Permalink
check in stderrFrame is nil before logging stderrFrame.Data (#17815)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmulvey authored and jrasell committed Jul 24, 2023
1 parent 7a7d93a commit 9b0e75b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/17815.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
cli: Fix panic in `alloc logs` command when receiving empty stdout or stderr log frames
```
8 changes: 6 additions & 2 deletions command/alloc_logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,11 +394,15 @@ func (l *AllocLogsCommand) tailMultipleFiles(client *api.Client, alloc *api.Allo
case stdoutErr := <-stdoutErrCh:
return fmt.Errorf("received an error from stdout log stream: %v", stdoutErr)
case stdoutFrame := <-stdoutFrames:
logUI.Output(string(stdoutFrame.Data))
if stdoutFrame != nil {
logUI.Output(string(stdoutFrame.Data))
}
case stderrErr := <-stderrErrCh:
return fmt.Errorf("received an error from stderr log stream: %v", stderrErr)
case stderrFrame := <-stderrFrames:
logUI.Warn(string(stderrFrame.Data))
if stderrFrame != nil {
logUI.Warn(string(stderrFrame.Data))
}
}
}
}
Expand Down

0 comments on commit 9b0e75b

Please sign in to comment.