Files
podman/cmd/podman/errors.go
Daniel J Walsh fe4c0c3780 Change exit code to 1 on podman rmi nosuch image
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>
2019-02-25 12:49:27 -05:00

24 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())
}
}