How can I get the exit code from pods().exec()? #4040
Replies: 4 comments 2 replies
-
This is pretty much what I found in the example: https://github.com/fabric8io/kubernetes-client/blob/master/kubernetes-examples/src/main/java/io/fabric8/kubernetes/examples/ExecExample.java |
Beta Was this translation helpful? Give feedback.
-
#3813 added ExecListener.onExit. And a recent change for 6.0 added ExecWatch.exitCode. |
Beta Was this translation helpful? Give feedback.
-
Ah, thanks, I really need to upgrade to 6. |
Beta Was this translation helpful? Give feedback.
-
For completeness: Version 6.x is out and there is an |
Beta Was this translation helpful? Give feedback.
-
I've use the example to run a command in a pod, and the command is executing successfully. However, I would like to capture the exit code, and I don't see any API method that allows me to do that.
My Java code:
My SimpleListener captures the code from the
onClose()
method, but that is always 1000, and looking at the code inExecWebSocketListener
, it seems to be something from the WebSocket client, not the exit code of the executed process. I would have expectedExecWatch
to have a method to retrieve the code, but it doesn't.Beta Was this translation helpful? Give feedback.
All reactions