mirror of
https://github.com/containers/podman.git
synced 2025-09-28 09:15:26 +08:00
Migrate to cobra CLI
We intend to migrate to the cobra cli from urfave/cli because the project is more well maintained. There are also some technical reasons as well which extend into our remote client work. Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
30
vendor/github.com/containers/buildah/util/util.go
generated
vendored
30
vendor/github.com/containers/buildah/util/util.go
generated
vendored
@ -9,6 +9,7 @@ import (
|
||||
"path"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/containers/image/directory"
|
||||
dockerarchive "github.com/containers/image/docker/archive"
|
||||
@ -419,3 +420,32 @@ func GetPolicyContext(ctx *types.SystemContext) (*signature.PolicyContext, error
|
||||
}
|
||||
return policyContext, nil
|
||||
}
|
||||
|
||||
// logIfNotErrno logs the error message unless err is either nil or one of the
|
||||
// listed syscall.Errno values. It returns true if it logged an error.
|
||||
func logIfNotErrno(err error, what string, ignores ...syscall.Errno) (logged bool) {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
if errno, isErrno := err.(syscall.Errno); isErrno {
|
||||
for _, ignore := range ignores {
|
||||
if errno == ignore {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
logrus.Error(what)
|
||||
return true
|
||||
}
|
||||
|
||||
// LogIfNotRetryable logs "what" if err is set and is not an EINTR or EAGAIN
|
||||
// syscall.Errno. Returns "true" if we can continue.
|
||||
func LogIfNotRetryable(err error, what string) (retry bool) {
|
||||
return !logIfNotErrno(err, what, syscall.EINTR, syscall.EAGAIN)
|
||||
}
|
||||
|
||||
// LogIfUnexpectedWhileDraining logs "what" if err is set and is not an EINTR
|
||||
// or EAGAIN or EIO syscall.Errno.
|
||||
func LogIfUnexpectedWhileDraining(err error, what string) {
|
||||
logIfNotErrno(err, what, syscall.EINTR, syscall.EAGAIN, syscall.EIO)
|
||||
}
|
||||
|
Reference in New Issue
Block a user