summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2020-04-08 08:22:09 -0400
committerDaniel J Walsh <dwalsh@redhat.com>2020-04-08 15:54:35 -0400
commit82bd7589e7a6c930c6ddfce43d956304cb3e3f8b (patch)
tree189074422f89bf56ed35926ff66645927ee03e27 /cmd
parentf71e4d3d3e6da338a253c951920d2e8671773864 (diff)
downloadpodman-82bd7589e7a6c930c6ddfce43d956304cb3e3f8b.tar.gz
podman-82bd7589e7a6c930c6ddfce43d956304cb3e3f8b.tar.bz2
podman-82bd7589e7a6c930c6ddfce43d956304cb3e3f8b.zip
Set exit codes on errors.
podmanV2 run fedora /etc Should exit with 126 podmanV2 run fedora /etc/foobar Should exit with 127 podmanv2 run --fobar fedora echo hello Should exit with 125 podmanv2 run fedora bash -c "exit 100" Should exit with 100 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podmanV2/containers/run.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/podmanV2/containers/run.go b/cmd/podmanV2/containers/run.go
index 5c0069afc..f839c358d 100644
--- a/cmd/podmanV2/containers/run.go
+++ b/cmd/podmanV2/containers/run.go
@@ -109,13 +109,14 @@ func run(cmd *cobra.Command, args []string) error {
}
runOpts.Spec = s
report, err := registry.ContainerEngine().ContainerRun(registry.GetContext(), runOpts)
+ // report.ExitCode is set by ContainerRun even it it returns an error
+ registry.SetExitCode(report.ExitCode)
if err != nil {
return err
}
if cliVals.Detach {
fmt.Println(report.Id)
}
- registry.SetExitCode(report.ExitCode)
if runRmi {
_, err := registry.ImageEngine().Delete(registry.GetContext(), []string{report.Id}, entities.ImageDeleteOptions{})
if err != nil {