summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorGiuseppe Scrivano <gscrivan@redhat.com>2019-03-08 16:36:49 +0100
committerGiuseppe Scrivano <gscrivan@redhat.com>2019-03-08 19:42:20 +0100
commitcc411dd98fed42a19d2d4f8ec1922ba62da49957 (patch)
tree94e0545a80269d4dd22de0fe87e100c2d3e24fe9 /libpod
parent8a21e231e63e557448f3471ff57a27fac682d9cc (diff)
downloadpodman-cc411dd98fed42a19d2d4f8ec1922ba62da49957.tar.gz
podman-cc411dd98fed42a19d2d4f8ec1922ba62da49957.tar.bz2
podman-cc411dd98fed42a19d2d4f8ec1922ba62da49957.zip
rootless: propagate errors from info
we use "podman info" to reconfigure the runtime after a reboot, but we don't propagate the error message back if something goes wrong. Closes: https://github.com/containers/libpod/issues/2584 Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/runtime.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/libpod/runtime.go b/libpod/runtime.go
index 482cd9d73..9667abfe6 100644
--- a/libpod/runtime.go
+++ b/libpod/runtime.go
@@ -971,9 +971,12 @@ func (r *Runtime) refreshRootless() error {
// Take advantage of a command that requires a new userns
// so that we are running as the root user and able to use refresh()
cmd := exec.Command(os.Args[0], "info")
- err := cmd.Run()
- if err != nil {
- return errors.Wrapf(err, "Error running %s info while refreshing state", os.Args[0])
+
+ if output, err := cmd.CombinedOutput(); err != nil {
+ if _, ok := err.(*exec.ExitError); !ok {
+ return errors.Wrapf(err, "Error waiting for info while refreshing state: %s", os.Args[0])
+ }
+ return errors.Wrapf(err, "Error running %s info while refreshing state: %s", os.Args[0], output)
}
return nil
}