diff options
author | Matthew Heon <mheon@redhat.com> | 2020-07-21 11:14:13 -0400 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2020-07-21 13:28:40 -0400 |
commit | 90e547ec1a0cacd2e2b5f2365972cb26484026a2 (patch) | |
tree | 8fb35ecfe793e5e2007057f90bd4c44b2d86caec /libpod | |
parent | f8e2a3500e3daadf21137d1647cabf9ef20b2114 (diff) | |
download | podman-90e547ec1a0cacd2e2b5f2365972cb26484026a2.tar.gz podman-90e547ec1a0cacd2e2b5f2365972cb26484026a2.tar.bz2 podman-90e547ec1a0cacd2e2b5f2365972cb26484026a2.zip |
Do not print an error message on non-0 exec exit code
This was added with an earlier exec rework, and honestly is very
confusing. Podman is printing an error message, but the error had
nothing to do with Podman; it was the executable we ran inside
the container that errored, and per `podman run` convention we
should set the Podman exit code to the process's exit code and
print no error.
Signed-off-by: Matthew Heon <mheon@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/container_exec.go | 4 | ||||
-rw-r--r-- | libpod/healthcheck.go | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/libpod/container_exec.go b/libpod/container_exec.go index bd04ee9b9..a16aea06d 100644 --- a/libpod/container_exec.go +++ b/libpod/container_exec.go @@ -729,10 +729,6 @@ func (c *Container) Exec(config *ExecConfig, streams *define.AttachStreams, resi return -1, err } - if exitCode != 0 { - return exitCode, errors.Wrapf(define.ErrOCIRuntime, "exec session exited with non-zero exit code %d", exitCode) - } - return exitCode, nil } diff --git a/libpod/healthcheck.go b/libpod/healthcheck.go index b04742974..4818f8dc4 100644 --- a/libpod/healthcheck.go +++ b/libpod/healthcheck.go @@ -92,7 +92,7 @@ func (c *Container) runHealthCheck() (define.HealthCheckStatus, error) { hcResult := define.HealthCheckSuccess config := new(ExecConfig) config.Command = newCommand - _, hcErr := c.Exec(config, streams, nil) + exitCode, hcErr := c.Exec(config, streams, nil) if hcErr != nil { errCause := errors.Cause(hcErr) hcResult = define.HealthCheckFailure @@ -104,6 +104,9 @@ func (c *Container) runHealthCheck() (define.HealthCheckStatus, error) { } else { returnCode = 125 } + } else if exitCode != 0 { + hcResult = define.HealthCheckFailure + returnCode = 1 } timeEnd := time.Now() if c.HealthCheckConfig().StartPeriod > 0 { |