mirror of
https://github.com/corda/corda.git
synced 2025-01-21 03:55:00 +00:00
fix bug which caused Runtime.exec to block until process exits
This commit is contained in:
parent
ababc5748d
commit
2d60398e63
@ -65,24 +65,26 @@ public class Runtime {
|
|||||||
exec(command, info);
|
exec(command, info);
|
||||||
process[0] = new MyProcess
|
process[0] = new MyProcess
|
||||||
(info[0], (int) info[1], (int) info[2], (int) info[3]);
|
(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) {
|
} catch (Throwable e) {
|
||||||
exception[0] = e;
|
exception[0] = e;
|
||||||
} finally {
|
} finally {
|
||||||
process.notifyAll();
|
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);
|
t.setDaemon(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user