summaryrefslogtreecommitdiff
path: root/pkg/adapter
diff options
context:
space:
mode:
authorPeter Hunt <pehunt@redhat.com>2019-07-22 15:12:29 -0400
committerPeter Hunt <pehunt@redhat.com>2019-07-23 13:29:33 -0400
commit479eeac62cd74e32cbe74fc8afbfc82d4d8a8abd (patch)
treea343b6279109433381eee0b5e885610823f252de /pkg/adapter
parent35ba77e0409036c455f85d9f8fcbe361f0693335 (diff)
downloadpodman-479eeac62cd74e32cbe74fc8afbfc82d4d8a8abd.tar.gz
podman-479eeac62cd74e32cbe74fc8afbfc82d4d8a8abd.tar.bz2
podman-479eeac62cd74e32cbe74fc8afbfc82d4d8a8abd.zip
move editing of exitCode to runtime
There's no way to get the error if we successfully get an exit code (as it's just printed to stderr instead). instead of relying on the error to be passed to podman, and edit based on the error code, process it on the varlink side instead Also move error codes to define package Signed-off-by: Peter Hunt <pehunt@redhat.com>
Diffstat (limited to 'pkg/adapter')
-rw-r--r--pkg/adapter/containers.go9
-rw-r--r--pkg/adapter/containers_remote.go2
2 files changed, 9 insertions, 2 deletions
diff --git a/pkg/adapter/containers.go b/pkg/adapter/containers.go
index 47f1b091e..a8bff187c 100644
--- a/pkg/adapter/containers.go
+++ b/pkg/adapter/containers.go
@@ -1000,7 +1000,14 @@ func (r *LocalRuntime) ExecContainer(ctx context.Context, cli *cliconfig.ExecVal
streams.AttachOutput = true
streams.AttachError = true
- return ExecAttachCtr(ctx, ctr.Container, cli.Tty, cli.Privileged, envs, cmd, cli.User, cli.Workdir, streams, cli.PreserveFDs, cli.DetachKeys)
+ ec, err = ExecAttachCtr(ctx, ctr.Container, cli.Tty, cli.Privileged, envs, cmd, cli.User, cli.Workdir, streams, cli.PreserveFDs, cli.DetachKeys)
+ if errors.Cause(err) == define.ErrOCIRuntimePermissionDenied {
+ ec = 126
+ }
+ if errors.Cause(err) == define.ErrOCIRuntimeNotFound {
+ ec = 127
+ }
+ return ec, err
}
// Prune removes stopped containers
diff --git a/pkg/adapter/containers_remote.go b/pkg/adapter/containers_remote.go
index 7a9cf94b7..7fce30378 100644
--- a/pkg/adapter/containers_remote.go
+++ b/pkg/adapter/containers_remote.go
@@ -997,7 +997,7 @@ func (r *LocalRuntime) Commit(ctx context.Context, c *cliconfig.CommitValues, co
func (r *LocalRuntime) ExecContainer(ctx context.Context, cli *cliconfig.ExecValues) (int, error) {
var (
oldTermState *term.State
- ec int = 125
+ ec int = define.ExecErrorCodeGeneric
)
// default invalid command exit code
// Validate given environment variables