diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2021-08-03 09:02:18 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2021-08-11 15:28:18 -0400 |
commit | 67bf11e8c8418d06528bf16b184f77e99a738d05 (patch) | |
tree | 8b122176f9f12e73569b3c864492a2a269860131 /cmd | |
parent | a1afb2300f1a65a4213753c587ba8a7d66755423 (diff) | |
download | podman-67bf11e8c8418d06528bf16b184f77e99a738d05.tar.gz podman-67bf11e8c8418d06528bf16b184f77e99a738d05.tar.bz2 podman-67bf11e8c8418d06528bf16b184f77e99a738d05.zip |
Fix podman unpause,pause,kill --all to work like podman stop --all
Currently if you execute podman unpause --all, podman pause --all
Podman shows attempts to unpause containers that are not paused
and prints an error. This PR catches this error and only prints errors if
a paused container was not able to be unpaused.
Currently if you execute podman pause --all or podman kill --all, Podman
Podman shows attempts to pause or kill containers that are not running
and prints an error. This PR catches this error and only prints errors if
a running container was not able to be paused or killed.
Also change printing of multiple errors to go to stderr and to prefix
"Error: " in front to match the output of the last error.
Fixes: https://github.com/containers/podman/issues/11098
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/podman/utils/error.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd/podman/utils/error.go b/cmd/podman/utils/error.go index 3464f0779..2d58bc70d 100644 --- a/cmd/podman/utils/error.go +++ b/cmd/podman/utils/error.go @@ -1,6 +1,9 @@ package utils -import "fmt" +import ( + "fmt" + "os" +) type OutputErrors []error @@ -10,7 +13,7 @@ func (o OutputErrors) PrintErrors() (lastError error) { } lastError = o[len(o)-1] for e := 0; e < len(o)-1; e++ { - fmt.Println(o[e]) + fmt.Fprintf(os.Stderr, "Error: %s\n", o[e]) } return } |