Skip to content
Snippets Groups Projects
Commit ce3156c9 authored by goapunk's avatar goapunk
Browse files

Use ProcessBuilder instead of Runtime to start tor


* ProcessBuilder copies the ENV from the current proc
  and preserves ANDROID_ROOT and ANDROID_DATA

Signed-off-by: default avatargoapunk <noobie@goapunks.net>
parent be3752bf
No related branches found
No related tags found
No related merge requests found
......@@ -182,15 +182,14 @@ class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
String torPath = torFile.getAbsolutePath();
String configPath = configFile.getAbsolutePath();
String pid = String.valueOf(android.os.Process.myPid());
String[] cmd = {torPath, "-f", configPath, OWNER, pid};
String[] env = {
"HOME=" + torDirectory.getAbsolutePath(),
"ANDROID_ROOT=/system",
"ANDROID_DATA=/data"
};
Process torProcess;
ProcessBuilder pb =
new ProcessBuilder(torPath, "-f", configPath, OWNER, pid);
Map<String, String> env = pb.environment();
env.put("HOME", torDirectory.getAbsolutePath());
pb.directory(torDirectory);
try {
torProcess = Runtime.getRuntime().exec(cmd, env, torDirectory);
torProcess = pb.start();
} catch (SecurityException | IOException e) {
throw new PluginException(e);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment