This project is read-only.

Retrieving exit code of a command executed via ShellStream

May 30, 2012 at 1:51 PM

Hy all,

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

Can anybody help me?

Coordinator
Jun 18, 2012 at 6: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.

 

Thanks,

Oleg

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

Hi Schmid,

 

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

"

./mycommand.sh

retcode=$?

"

 

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:

 

Script:

"

 

if [ $retcode -ne 0 ]

then

echo command did not exit with 0 status.

# do something else here to handle this situation

fi

 "

 

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

 

 

 "

 echo MY_COMMAND_RETURN_CODE_IS $retcode

 "

 

 cheers,

 

 Paul.