Do not print an error message on non-0 exec exit code#3462
Do not print an error message on non-0 exec exit code#3462zouyee wants to merge 2 commits intocontainerd:mainfrom
Conversation
This was added with an earlier exec, and it is very confusing. the error had nothing to do with Containerd; it was the executable we ran inside the container that errored, and per task run convention we should set the Containerd exit code to the process's exit code and print no error. Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
|
I believe this was purposely printed for consistency with Docker, but can't verify it on phone |
|
FWIW: It looks like this may have been introduced in: Not clear what was the reason, as this is part of a refactor. |
| if err != nil { | ||
| return err | ||
| } | ||
| if code != 0 { |
There was a problem hiding this comment.
@zouyee not displaying the message is one thing, but clearly we still need to error out.
There was a problem hiding this comment.
The executable we ran inside the container that errored, we need to print error ?
There was a problem hiding this comment.
We need to return an error from this method, otherwise nerdctl will exit 0.
There was a problem hiding this comment.
Why does exec function care about the results of execution inside the container?
There was a problem hiding this comment.
It should be just same as Docker
There was a problem hiding this comment.
nerdctl exec
nerdctl -n k8s.io exec xxx bash -c 'bash ./faketime.sh xxx';echo $?
tomcat: stopped
tomcat: started
FATA[0005] exec failed with exit code 1
1
docker exec
docker exec xxx bash -c 'bash ./faketime.sh xxx';echo $?
tomcat: stopped
tomcat: started
1
There was a problem hiding this comment.
Yes, we should do the same thing as docker.
With your patch right now, we no longer return exit 1 because you do not return a go error.
There was a problem hiding this comment.
@zouyee you may write stderr to /dev/null as workaround
This was added with an earlier exec, and it is very confusing. the error had nothing to do with Containerd; it was the executable we ran inside the container that errored, and per task run convention we should set the Containerd exit code to the process's exit code and print no error.
ctr exec
nerdctl exec
docker exec