fix a crash when timeout in Exec

This commit is contained in:
Max Lv
2012-12-25 20:33:16 +08:00
parent 88ecb02ecf
commit d01295b3f5
3 changed files with 18 additions and 5 deletions
+15 -2
View File
@@ -271,6 +271,21 @@ public class Utils {
private final boolean asroot;
public int exitcode = -1;
private int[] pid = new int[1];
private FileDescriptor pipe;
@Override
public void destroy() {
if (pid[0] != -1) {
Exec.hangupProcessGroup(pid[0]);
pid[0] = -1;
}
if (pipe != null) {
Exec.close(pipe);
pipe = null;
}
}
/**
* Creates a new script runner.
*
@@ -344,8 +359,6 @@ public class Utils {
@Override
public void run() {
FileDescriptor pipe = null;
int pid[] = new int[1];
pid[0] = -1;
try {