mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-06 00:45:43 +00:00
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>
19 lines
270 B
Go
19 lines
270 B
Go
package utils
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
type OutputErrors []error
|
|
|
|
func (o OutputErrors) PrintErrors() (lastError error) {
|
|
if len(o) == 0 {
|
|
return
|
|
}
|
|
lastError = o[len(o)-1]
|
|
for e := 0; e < len(o)-1; e++ {
|
|
fmt.Fprintf(os.Stderr, "Error: %s\n", o[e])
|
|
}
|
|
return
|
|
}
|