Created
August 7, 2010 17:00
-
-
Save koush/512983 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Process runSuCommandAsync(Context context, String command) throws IOException | |
{ | |
DataOutputStream fout = new DataOutputStream(context.openFileOutput(SCRIPT_NAME, 0)); | |
fout.writeBytes(command); | |
fout.close(); | |
String[] args = new String[] { "su", "-c", ". " + context.getFilesDir().getAbsolutePath() + "/" + SCRIPT_NAME }; | |
Process proc = Runtime.getRuntime().exec(args); | |
return proc; | |
} | |
public static int runSuCommand(Context context, String command) throws IOException, InterruptedException | |
{ | |
return runSuCommandAsync(context, command).waitFor(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment