-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What happened to "waitForFinish" ? #10
Comments
That's really weird. At least give people choice, or put documentation (the old ones still exist), or deprecate it... I used this library to make things a bit easier, but if the minimal thing is not possible, I think I will make my own solution. It's not the hardest thing to do. Anyway, I think I will make my own solution. I just need the root stuff. |
I always put credits to all libraries that I use, even in code (so that it will be easier to find) . This is my app: |
Another method is to take advantage of Java's threading public static class RootCommandRunner extends Thread {
@Override
public void run() {
try {
Command command = new Command(0, "root command here") {
@Override
public void commandOutput(int id, String line) {
}
@Override
public void commandCompleted(int id, int exitCode) {
synchronized (RootCommandRunner.this) {
RootCommandRunner.this.notify();
}
}
@Override
public void commandTerminated(int id, String reason) {
synchronized (RootCommandRunner.this) {
RootCommandRunner.this.notify();
}
}
};
RootTools.getShell(true).add(command);
synchronized (this) {
wait();
}
// Anything here will execute after the command is finished
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (TimeoutException e) {
e.printStackTrace();
} catch (RootDeniedException e) {
e.printStackTrace();
}
}
} |
@chenxiaolong If you want to use a wait-notifier mechanism , I think this is the correct way to do it: |
I haven't updated the library in a while.
I want to perform some root operations via a background thread, and found out this function is missing.
What should I use instead?
How can I perform multiple commands, and wait for all to finish?
The text was updated successfully, but these errors were encountered: