Closed GoogleCodeExporter closed 8 years ago
How are you coming to the conclusion that waitForFinish is not waiting?
Can you turn debug mode on for RootTools and capture a log?
Original comment by Stericso...@gmail.com
on 19 Jun 2013 at 1:08
I know it's not waiting because it returns blank string, if it waited it would
return the user profile directory of Firefox on the device. Setting breakpoints
in output function, and after waitForFinish, confirms that not all output() are
processed before the waitForFinish.
I'm seeing this in the logcat:
06-19 23:10:25.508: D/RootTools v2.6(25904): Command 0finished.
06-19 23:10:25.508: D/RootTools v2.6(25904): Using Existing Root Shell!
06-19 23:10:25.508: D/RootTools v2.6(25904): Sending command(s): ls
/data/data/org.mozilla.firefox/files/mozilla/
06-19 23:10:25.528: D/RootTools v2.6(25904): Command 0finished.
06-19 23:10:25.538: D/RootTools v2.6(25904): Using Existing Root Shell!
06-19 23:10:25.538: D/RootTools v2.6(25904): Sending command(s):
07uxqsq0.default
I wonder if existing shell could be the problem?
Original comment by luke...@msn.com
on 20 Jun 2013 at 6:15
Can you try this version for me?
This is scheduled to be v3.0
Let me know if the same issue exists.
Original comment by Stericso...@gmail.com
on 20 Jun 2013 at 1:59
It's still happening, but not all the time. Sometimes the line after
waitForFinish is first to run, sometimes the output() are called before the
lines after waitForFinish.
Original comment by luke...@msn.com
on 22 Jun 2013 at 7:04
This has been fixed. I believe that what is happening is that you are being hit
by the timeout exception.
This is not always obvious however because of a design flaw in the application.
In this new version please note that I have deprecated waitForFinish(), you can
still use it if you like but I strongly recommend not using it.
Also, please notice that you need to implement two methods when extending
Command, commandTerminated and commandCompleted. These methods will allow you
to determine if a command has executed correctly or it was terminated for some
reason, like a timeout exception.
If you are running long operations in the shell, consider increasing the
timeout by passing it into the timeout constructor. The default is 50000
seconds which should be enough for normal operations.
Original comment by Stericso...@gmail.com
on 27 Jun 2013 at 4:24
Sorry, that should have been "Command constructor" instead of "timeout
constructor"
Original comment by Stericso...@gmail.com
on 27 Jun 2013 at 4:29
Updated the binary to address another issue. When a command has been terminated
output from the shell will stop immediately upon that termination.
Original comment by Stericso...@gmail.com
on 27 Jun 2013 at 4:52
Attachments:
Thanks, it seems to be working now. I noticed both waitForFinish and exitCode()
are deprecated, so what is the recommended way of running a Command now? I'm
curious how the exit code could be sent to the app, when the output is not yet
processed, but I guess that's some sort of Java buffer/output thing?
Original comment by luke...@msn.com
on 28 Jun 2013 at 5:29
waitForFinish never executed the command.
The shell is constantly executing commands as they are added to it. So when you
call add(command) the command get's put into a que and will be the executed as
soon as it can be executed.
You should extend Command and implement the three methods there. Two of the
methods, commandTerminated and commandFinished, will let you know when your
command has finished. commandFinished will also return to you the exitcode for
the command in question.
I also uploaded the most recent version that I have built, it has the method
getExitCode() that you can use to fetch the exitcode after the command has
finished.
Hope that helps.
Original comment by Stericso...@gmail.com
on 28 Jun 2013 at 1:49
Attachments:
Original comment by Stericso...@gmail.com
on 28 Jun 2013 at 6:41
Thanks, but I'm having one big problem in converting code to this new working
3.0
Previously you could waitforFinish a number of tasks, and do something when
they finished.
Now I don't know if this is possible - I know there's join on thread, but this
isn't exactly a thread. Is something like this possible?
http://stackoverflow.com/questions/17418194/multiple-callback-waiting-in-android
-java
Original comment by luke...@msn.com
on 3 Jul 2013 at 2:24
I posted an answer here:
http://stackoverflow.com/questions/17418194/multiple-callback-waiting-in-android
-java/17438858#17438858
Original comment by Stericso...@gmail.com
on 3 Jul 2013 at 2:45
Original issue reported on code.google.com by
luke...@msn.com
on 19 Jun 2013 at 6:24