updated script for shell cmd logging

This commit is contained in:
Nathan Freitas 2012-01-16 22:54:42 -05:00
parent ee9e3d7c8b
commit 9935cc8784
1 changed files with 40 additions and 46 deletions

View File

@ -161,13 +161,11 @@ public class TorServiceUtils implements TorServiceConstants {
public static int doShellCommand(String[] cmds, StringBuilder log, boolean runAsRoot, boolean waitFor) throws Exception public static int doShellCommand(String[] cmds, StringBuilder log, boolean runAsRoot, boolean waitFor) throws Exception
{ {
TorService.logMessage("executing shell cmds: " + cmds[0] + "; runAsRoot=" + runAsRoot); TorService.logMessage("executing shell cmds: " + cmds[0] + "; runAsRoot=" + runAsRoot + ";waitFor=" + waitFor);
Process proc = null; Process proc = null;
int exitCode = -1; int exitCode = -1;
if (runAsRoot) if (runAsRoot)
proc = Runtime.getRuntime().exec("su"); proc = Runtime.getRuntime().exec("su");
else else
@ -206,11 +204,7 @@ public class TorServiceUtils implements TorServiceConstants {
} }
exitCode = proc.waitFor(); exitCode = proc.waitFor();
log.append("process exit code: ");
log.append(exitCode);
log.append("\n");
TorService.logMessage("command process exit value: " + exitCode);
} }