mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-21 07:09:56 +01:00
Merge branch '903_replace_Runtime_with_ProcessBuilder' into 'master'
Use ProcessBuilder instead of Runtime to start tor See merge request !487
This commit is contained in:
@@ -188,15 +188,14 @@ class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
|||||||
String torPath = torFile.getAbsolutePath();
|
String torPath = torFile.getAbsolutePath();
|
||||||
String configPath = configFile.getAbsolutePath();
|
String configPath = configFile.getAbsolutePath();
|
||||||
String pid = String.valueOf(android.os.Process.myPid());
|
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;
|
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 {
|
try {
|
||||||
torProcess = Runtime.getRuntime().exec(cmd, env, torDirectory);
|
torProcess = pb.start();
|
||||||
} catch (SecurityException | IOException e) {
|
} catch (SecurityException | IOException e) {
|
||||||
throw new PluginException(e);
|
throw new PluginException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user