diff --git a/drivers/rescontainerocibase/executor.go b/drivers/rescontainerocibase/executor.go index d9a3fe279..a01a5b4c9 100644 --- a/drivers/rescontainerocibase/executor.go +++ b/drivers/rescontainerocibase/executor.go @@ -404,12 +404,6 @@ func (e *Executor) doExecRunLogs(ctx context.Context, a ...string) (<-chan []byt buf := make([]byte, 4096) for { n, err := stream.Read(buf) - if err != nil { - if err != io.EOF { - e.log().Warnf("error reading container logs %s: %s", name, err) - } - return - } if n > 0 { // Copy the data to a new slice to avoid race conditions data := make([]byte, n) @@ -420,6 +414,12 @@ func (e *Executor) doExecRunLogs(ctx context.Context, a ...string) (<-chan []byt return } } + if err != nil { + if err != io.EOF { + e.log().Warnf("error reading container logs %s: %s", name, err) + } + return + } } }