fix bug which caused Runtime.exec to block until process exits

This commit is contained in:
Joel Dice 2010-11-09 12:38:23 -07:00
parent ababc5748d
commit 2d60398e63

View File

@ -65,24 +65,26 @@ public class Runtime {
exec(command, info);
process[0] = new MyProcess
(info[0], (int) info[1], (int) info[2], (int) info[3]);
MyProcess p = process[0];
synchronized (p) {
try {
if (p.pid != 0) {
p.exitCode = Runtime.waitFor(p.pid);
p.pid = 0;
}
} finally {
p.notifyAll();
}
}
} catch (Throwable e) {
exception[0] = e;
} finally {
process.notifyAll();
}
}
MyProcess p = process[0];
if (p != null) {
synchronized (p) {
try {
if (p.pid != 0) {
p.exitCode = Runtime.waitFor(p.pid);
p.pid = 0;
}
} finally {
p.notifyAll();
}
}
}
}
};
t.setDaemon(true);