Skip to content

Commit

Permalink
fix: archiveLogs needs to copy stderr (#2136)
Browse files Browse the repository at this point in the history
  • Loading branch information
tcolgate authored Feb 3, 2020
1 parent 91319ee commit 14d8b5d
Showing 1 changed file with 11 additions and 3 deletions.
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))
}

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

0 comments on commit 14d8b5d

Please sign in to comment.