+ try {
+ DataOutputStream sh = new DataOutputStream(rootcmd.getOutputStream());
+ sh.writeBytes(command + "\n");
+ sh.writeBytes("exit\n");
+ sh.flush();
+ sh.close();
+ } catch (java.io.IOException e) {
+ Log.e(TAG, "Got IOException: " + e.getMessage() + " (" + e.getCause() + ")");
+ throw new ShellException();
+ }
+
+ try {
+ int r = rootcmd.waitFor();
+
+ if (r != 0) {
+ Log.e(TAG, "Process returned: " + r);
+ throw new ShellException();
+ }
+ } catch (java.lang.InterruptedException e) {
+ Log.e(TAG, "Got InterruptedException: " + e.getMessage() + " (" + e.getCause() + ")");
+ throw new ShellException();
+ }
+
+ Log.i(TAG, "Process executed successfully");