summaryrefslogtreecommitdiff
path: root/pkg/varlinkapi/containers.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/varlinkapi/containers.go')
-rw-r--r--pkg/varlinkapi/containers.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/pkg/varlinkapi/containers.go b/pkg/varlinkapi/containers.go
index a70a87675..fa17bed84 100644
--- a/pkg/varlinkapi/containers.go
+++ b/pkg/varlinkapi/containers.go
@@ -812,7 +812,7 @@ func (i *LibpodAPI) ExecContainer(call iopodman.VarlinkCall, opts iopodman.ExecO
go func() {
if err := virtwriter.Reader(reader, nil, nil, pipeWriter, resizeChan, nil); err != nil {
ecErrChan <- ExitCodeError{
- 125, //TODO FIXME magic number, define package?
+ define.ExecErrorCodeGeneric,
err,
}
}
@@ -833,7 +833,15 @@ func (i *LibpodAPI) ExecContainer(call iopodman.VarlinkCall, opts iopodman.ExecO
ecErr := <-ecErrChan
// TODO FIXME prevent all of these conversions
- if err = virtwriter.HangUp(writer, int(ecErr.ExitCode)); err != nil {
+ exitCode := int(ecErr.ExitCode)
+ if errors.Cause(ecErr.Error) == define.ErrOCIRuntimePermissionDenied {
+ exitCode = define.ExecErrorCodeCannotInvoke
+ }
+ if errors.Cause(ecErr.Error) == define.ErrOCIRuntimeNotFound {
+ exitCode = define.ExecErrorCodeNotFound
+ }
+
+ if err = virtwriter.HangUp(writer, exitCode); err != nil {
logrus.Errorf("ExecContainer failed to HANG-UP on %s: %s", ctr.ID(), err.Error())
}