9097029885 / roottools

Automatically exported from code.google.com/p/roottools
0 stars 0 forks source link

Expose return value of Runtime Process #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I don't see any way to get the return value (what would show up in the shell as 
$?) from the command that was run via Process. Could you find some way to get 
the last return value and expose it to the caller?

Original issue reported on code.google.com by marshall...@gmail.com on 5 Jul 2011 at 4:07

GoogleCodeExporter commented 8 years ago
Do you mean the response from the shell after sending it a command? 
If this is right, you can retrieve this via the callback or the returned 
List<String>.

If this is not what you are referring to then I may need further clarification.

Original comment by Stericso...@gmail.com on 28 Jul 2011 at 4:23

GoogleCodeExporter commented 8 years ago
The OP is referring to the exit_code from the command essentially a 
success|fail. This can be done with RootTools.Result Object however it would be 
nice for a sendShell alternative which return exit_code rather than 
List<String>. Maybe 

public int sendSimpleShell(String command); 

I already have something similar in my own Core class which uses 
RootTools.getProcess().exitValue();

~

Original comment by lilh3r...@googlemail.com on 14 Aug 2011 at 12:05

GoogleCodeExporter commented 8 years ago
ok, I will look into this.

Original comment by Stericso...@gmail.com on 14 Nov 2011 at 6:07

GoogleCodeExporter commented 8 years ago
You can now get the return code from the Linked List when sending shell 
commands. It will be the Last item in the LinkedList. 

You can also retrieve the return code by running a commands, or commands, and 
then getting the value from the public variable lastExitCode.

Original comment by Stericso...@gmail.com on 14 Nov 2011 at 7:34