Tiago Veloso
Tiago Veloso

Reputation: 8563

Wait for command to finish in RootTools

I am using the RootTools library to execute some shell commands on my android App.

However I need to wait for the commands to finish before proceeding. The documentation shows a waitForFinish() method which is not available on the latest version of the library at least.

How would I accomplish a similar behaviour?

Upvotes: 5

Views: 717

Answers (1)

Andrea993
Andrea993

Reputation: 693

This work for me: First you must instace the command without enabling the handler (with false):

Command command = new Command(0, false, "cat")

Next do something like this:

         RootTools.getShell(true).add(command);
         while (!command.isFinished()) 
         {
                try
                {
                    Thread.sleep(50);
                } 
                catch (InterruptedException e)
                {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }

         }

Upvotes: 1

Related Questions