Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: archiveLogs needs to copy stderr #2136

Merged
merged 1 commit into from
Feb 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions workflow/executor/docker/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"compress/gzip"
"fmt"
"io"
"io/ioutil"
"os"
"os/exec"
"time"
Expand Down Expand Up @@ -72,13 +73,20 @@ func (d *DockerExecutor) CopyFile(containerID string, sourcePath string, destPat
func (d *DockerExecutor) GetOutputStream(containerID string, combinedOutput bool) (io.ReadCloser, error) {
cmd := exec.Command("docker", "logs", containerID)
log.Info(cmd.Args)
if combinedOutput {
cmd.Stderr = cmd.Stdout
}

reader, err := cmd.StdoutPipe()
if err != nil {
return nil, errors.InternalWrapError(err)
}

if combinedOutput {
stderr, err := cmd.StderrPipe()
if err != nil {
return nil, errors.InternalWrapError(err)
}
reader = ioutil.NopCloser(io.MultiReader(reader, stderr))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we do not close this correctly

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it needs to though. We aren't going to leak file handles as the executor actually exits after this. I've not seen any problems.

}

err = cmd.Start()
if err != nil {
return nil, errors.InternalWrapError(err)
Expand Down