Commit 7a522309 authored by zeroleak's avatar zeroleak
Browse files

fix findTorExecutableLocal()

parent a1bc326c
......@@ -48,10 +48,10 @@ public class JavaTorClient {
private Optional<File> findTorExecutableLocal() {
try {
// try uppercase
List<String> whichResult = CliUtils.exec("which Tor");
List<String> whichResult = CliUtils.execOrEmpty("which Tor");
if (whichResult.isEmpty()) {
// try lowercase
whichResult = CliUtils.exec("which tor");
whichResult = CliUtils.execOrEmpty("which tor");
}
if (whichResult.size() > 0) {
if (log.isDebugEnabled()) {
......
......@@ -180,6 +180,21 @@ public class CliUtils {
return jettyHttpClient;
}
public static List<String> execOrEmpty(String cmd) throws Exception {
try {
return exec(cmd);
} catch (Exception e) {
if (log.isDebugEnabled()) {
log.debug(
"execOrNull error: "
+ e.getClass().getName()
+ ": "
+ (e.getMessage() != null ? e.getMessage() : ""));
}
}
return new ArrayList<>();
}
public static List<String> exec(String cmd) throws Exception {
List<String> lines = new ArrayList<>();
Process proc = null;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment