summaryrefslogtreecommitdiff
path: root/pkg/adapter
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/adapter')
-rw-r--r--pkg/adapter/containers.go32
1 files changed, 27 insertions, 5 deletions
diff --git a/pkg/adapter/containers.go b/pkg/adapter/containers.go
index df9f13944..a257ef4f4 100644
--- a/pkg/adapter/containers.go
+++ b/pkg/adapter/containers.go
@@ -951,17 +951,31 @@ func (r *LocalRuntime) execPS(c *libpod.Container, args []string) ([]string, err
defer wPipe.Close()
defer rPipe.Close()
+ rErrPipe, wErrPipe, err := os.Pipe()
+ if err != nil {
+ return nil, err
+ }
+ defer wErrPipe.Close()
+ defer rErrPipe.Close()
+
streams := new(libpod.AttachStreams)
streams.OutputStream = wPipe
- streams.ErrorStream = wPipe
+ streams.ErrorStream = wErrPipe
streams.AttachOutput = true
streams.AttachError = true
- psOutput := []string{}
+ stdout := []string{}
go func() {
scanner := bufio.NewScanner(rPipe)
for scanner.Scan() {
- psOutput = append(psOutput, scanner.Text())
+ stdout = append(stdout, scanner.Text())
+ }
+ }()
+ stderr := []string{}
+ go func() {
+ scanner := bufio.NewScanner(rErrPipe)
+ for scanner.Scan() {
+ stderr = append(stderr, scanner.Text())
}
}()
@@ -970,10 +984,18 @@ func (r *LocalRuntime) execPS(c *libpod.Container, args []string) ([]string, err
if err != nil {
return nil, err
} else if ec != 0 {
- return nil, errors.Errorf("Runtime failed with exit status: %d and output: %s", ec, strings.Join(psOutput, " "))
+ return nil, errors.Errorf("Runtime failed with exit status: %d and output: %s", ec, strings.Join(stderr, " "))
+ }
+
+ if logrus.GetLevel() >= logrus.DebugLevel {
+ // If we're running in debug mode or higher, we might want to have a
+ // look at stderr which includes debug logs from conmon.
+ for _, log := range stderr {
+ logrus.Debugf("%s", log)
+ }
}
- return psOutput, nil
+ return stdout, nil
}
// ExecContainer executes a command in the container