Retrieving exit code of a command executed via ShellStream

May 30, 2012 at 12:51 PM

Hy all,

I'm wondering how to get the exit code of a command executed via ShellStream.

Can anybody help me?

Jun 18, 2012 at 5:29 PM

Sorry for late response,


Sorry but its not possible thru the library, you can obviously execute unix command to get exit status, I am not familiar with one :(.

If you need to get exit status you need to use SshCommand instead of ShellStream.


Hope it helps.




Jun 23, 2012 at 10:28 AM
Edited Jun 23, 2012 at 10:32 AM

Hi Schmid,


In your shell, you can get the exit code of the last command run. Say your command is called, then in script do something like this.






The shell variable retcode now contains the exit status of your command. You can use this in  your script to determine the next action or you can simply outut it to the shell, and capture that output in the shellStream reader...



For example:





if [ $retcode -ne 0 ]


echo command did not exit with 0 status.

# do something else here to handle this situation




OR echo the return code and look for this in your application code.