summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-06-03 17:54:57 -0400
committerGitHub <noreply@github.com>2022-06-03 17:54:57 -0400
commit81f228b20a1d634821d2ff4b009f351366641847 (patch)
treeeae904ecc6f8be6b9795141dcdfde23e950d0eda /cmd
parentf4d8bf4afd291724a5ad4b342f76ec345eb76829 (diff)
parent259c79963f12d18b42d5455babf69b8ffdbb6b08 (diff)
downloadpodman-81f228b20a1d634821d2ff4b009f351366641847.tar.gz
podman-81f228b20a1d634821d2ff4b009f351366641847.tar.bz2
podman-81f228b20a1d634821d2ff4b009f351366641847.zip
Merge pull request #14466 from mheon/fix_9075
Improve robustness of `podman system reset`
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/system/reset.go14
1 files changed, 3 insertions, 11 deletions
diff --git a/cmd/podman/system/reset.go b/cmd/podman/system/reset.go
index 176573bf6..20f15a34f 100644
--- a/cmd/podman/system/reset.go
+++ b/cmd/podman/system/reset.go
@@ -91,18 +91,10 @@ func reset(cmd *cobra.Command, args []string) {
registry.ContainerEngine().Shutdown(registry.Context())
registry.ImageEngine().Shutdown(registry.Context())
- engine, err := infra.NewSystemEngine(entities.ResetMode, registry.PodmanConfig())
- if err != nil {
- logrus.Error(err)
- os.Exit(define.ExecErrorCodeGeneric)
- }
- defer engine.Shutdown(registry.Context())
-
- if err := engine.Reset(registry.Context()); err != nil {
+ // Do not try to shut the engine down, as a Reset engine is not valid
+ // after its creation.
+ if _, err := infra.NewSystemEngine(entities.ResetMode, registry.PodmanConfig()); err != nil {
logrus.Error(err)
- // FIXME change this to return the error like other commands
- // defer will never run on os.Exit()
- //nolint:gocritic
os.Exit(define.ExecErrorCodeGeneric)
}