Skip to content

Commit d59081d

Browse files
authored
use only stdout for reading container name (#745)
Signed-off-by: Ankita Thomas <[email protected]>
1 parent 7827c48 commit d59081d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pkg/containertools/runner.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,13 @@ func (r *ContainerCommandRunner) Unpack(image, src, dst string) error {
130130
r.logger.Infof("running %s create", r.containerTool)
131131
r.logger.Debugf("%s", command.Args)
132132

133-
out, err := command.CombinedOutput()
133+
out, err := command.Output()
134134
if err != nil {
135-
r.logger.Errorf(string(out))
136-
return fmt.Errorf("error creating container %s: %v", string(out), err)
135+
msg := err.Error()
136+
if exitErr, ok := err.(*exec.ExitError); ok {
137+
msg = fmt.Sprintf("%s: %s", err, exitErr.Stderr)
138+
}
139+
return fmt.Errorf("error creating container %s: %s", string(out), msg)
137140
}
138141

139142
id := strings.TrimSuffix(string(out), "\n")

0 commit comments

Comments
 (0)