[英]Wait for command to finish in RootTools
I am using the RootTools library to execute some shell commands on my android App. 我正在使用RootTools库在我的Android应用程序上执行一些shell命令。
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. 该文档显示了waitForFinish()
方法,该方法至少在最新版本的库中不可用。
How would I accomplish a similar behaviour? 我将如何完成类似的行为?
This work for me: First you must instace the command without enabling the handler
(with false): 这项工作对我来说:首先,您必须在不启用handler
情况下执行命令(使用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();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.