aboutsummaryrefslogtreecommitdiff
path: root/cmd/podman/create.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/create.go')
-rw-r--r--cmd/podman/create.go15
1 files changed, 11 insertions, 4 deletions
diff --git a/cmd/podman/create.go b/cmd/podman/create.go
index ce06ac51b..076e8c56e 100644
--- a/cmd/podman/create.go
+++ b/cmd/podman/create.go
@@ -154,6 +154,12 @@ func createCmd(c *cli.Context) error {
return err
}
+ if c.String("cidfile") != "" {
+ if err := libpod.WriteFile("", c.String("cidfile")); err != nil {
+ return errors.Wrapf(err, "unable to write cidfile %s", c.String("cidfile"))
+ }
+ }
+
runtime, err := getRuntime(c)
if err != nil {
return errors.Wrapf(err, "error creating libpod runtime")
@@ -196,11 +202,12 @@ func createCmd(c *cli.Context) error {
logrus.Debug("new container created ", ctr.ID())
if c.String("cidfile") != "" {
- libpod.WriteFile(ctr.ID(), c.String("cidfile"))
- } else {
- fmt.Printf("%s\n", ctr.ID())
+ err := libpod.WriteFile(ctr.ID(), c.String("cidfile"))
+ if err != nil {
+ logrus.Error(err)
+ }
}
-
+ fmt.Printf("%s\n", ctr.ID())
return nil
}