Tidy
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
e33612cced
commit
07552d10dd
|
@ -216,22 +216,22 @@ func copyLogStream(ctx context.Context, wg *sync.WaitGroup, client KubernetesCli
|
|||
// Closing the reader ensures that the goroutine below is not leaked.
|
||||
defer func() { _ = logReader.Close() }()
|
||||
|
||||
done := make(chan error, 1)
|
||||
errch := make(chan error, 1)
|
||||
go func() {
|
||||
defer close(done)
|
||||
defer close(errch)
|
||||
scanner := bufio.NewScanner(logReader)
|
||||
for scanner.Scan() {
|
||||
logsLines <- "[" + stream.podName + "] " + scanner.Text() + nl
|
||||
}
|
||||
if err := scanner.Err(); err != nil {
|
||||
done <- newLogError(fmt.Errorf("error scanning logs: %v", err), stream)
|
||||
errch <- newLogError(fmt.Errorf("error scanning logs: %v", err), stream)
|
||||
return
|
||||
}
|
||||
}()
|
||||
|
||||
for {
|
||||
select {
|
||||
case err := <-done:
|
||||
case err := <-errch:
|
||||
return err
|
||||
case <-stream.done:
|
||||
return nil
|
||||
|
|
Loading…
Reference in New Issue