mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-08-24 09:17:53 +00:00
Make it easy for scripts to determine if an image removal failure. If only errors were no such image exit with 1 versus 125. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
23 lines
399 B
Go
23 lines
399 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"os/exec"
|
|
"syscall"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
func outputError(err error) {
|
|
if MainGlobalOpts.LogLevel == "debug" {
|
|
logrus.Errorf(err.Error())
|
|
} else {
|
|
if ee, ok := err.(*exec.ExitError); ok {
|
|
if status, ok := ee.Sys().(syscall.WaitStatus); ok {
|
|
exitCode = status.ExitStatus()
|
|
}
|
|
}
|
|
fmt.Fprintln(os.Stderr, "Error:", err.Error())
|
|
}
|
|
}
|