mirror of
https://github.com/containers/podman.git
synced 2025-07-03 09:17:15 +08:00
Merge pull request #22347 from rhatdan/exec
podman exec CID without command should exit 125
This commit is contained in:
@ -29,6 +29,10 @@ func TranslateExecErrorToExitCode(originalEC int, err error) int {
|
||||
if errors.Is(err, ErrOCIRuntimeNotFound) {
|
||||
return ExecErrorCodeNotFound
|
||||
}
|
||||
if errors.Is(err, ErrInvalidArg) {
|
||||
return ExecErrorCodeGeneric
|
||||
}
|
||||
|
||||
return originalEC
|
||||
}
|
||||
|
||||
|
@ -32,11 +32,7 @@ var _ = Describe("Podman exec", func() {
|
||||
// With no command
|
||||
session = podmanTest.Podman([]string{"exec", "test1"})
|
||||
session.WaitWithDefaultTimeout()
|
||||
expectedStatus := 255
|
||||
if IsRemote() {
|
||||
expectedStatus = 125
|
||||
}
|
||||
Expect(session).Should(ExitWithError(expectedStatus, "must provide a non-empty command to start an exec session: invalid argument"))
|
||||
Expect(session).Should(ExitWithError(125, "must provide a non-empty command to start an exec session: invalid argument"))
|
||||
})
|
||||
|
||||
It("podman container exec simple command", func() {
|
||||
|
@ -33,6 +33,9 @@ load helpers
|
||||
run_podman 127 exec $cid /no/such/command
|
||||
is "$output" ".*such file or dir" "podman exec /no/such/command"
|
||||
|
||||
run_podman 125 exec $cid
|
||||
is "$output" ".*must provide a non-empty command to start an exec session" "podman exec must include a command"
|
||||
|
||||
# Done. Tell the container to stop.
|
||||
# The '-d' is because container exit is racy: the exec process itself
|
||||
# could get caught and killed by cleanup, causing this step to exit 137
|
||||
|
Reference in New Issue
Block a user