mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-22 18:01:02 +00:00
fix: docker backend should not close 'engine.Tail' result (#1616)
Closes https://github.com/woodpecker-ci/woodpecker/issues/1615 The error described in https://github.com/woodpecker-ci/woodpecker/issues/1615 is happening because `Tail` method of the docker backend closes the instance of `io.ReadCloser` it returns in `defer` function. As a result anything that try to read data returned by `Tail` method eventually will attempt to read from closes reader and get an error:2171212c5a/pipeline/backend/docker/docker.go (L229)
The fix is just don't close returned reader and let the consumer of `Tail` method do it. Good thing is that `Tail` is used only in one place and reader is correctly closed:2171212c5a/pipeline/pipeline.go (L231-L237)
Example of `woodpecker exec` output using pipeline from https://github.com/woodpecker-ci/woodpecker/issues/1615 with the fix: ``` woodpecker exec .woodpecker.yaml [step1:L0:0s] + echo step1 [step1:L1:0s] step1 [step2:L0:0s] + echo step2 [step2:L1:0s] step2 ``` Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com> Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
parent
9288670c61
commit
5e1171d7a7
1 changed files with 0 additions and 1 deletions
|
@ -226,7 +226,6 @@ func (e *docker) Tail(ctx context.Context, step *backend.Step) (io.ReadCloser, e
|
|||
_, _ = stdcopy.StdCopy(wc, wc, logs)
|
||||
_ = logs.Close()
|
||||
_ = wc.Close()
|
||||
_ = rc.Close()
|
||||
}()
|
||||
return rc, nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue