mirror of
https://github.com/corda/corda.git
synced 2025-01-28 15:14:48 +00:00
9bb3d6b972
git-subtree-dir: sgx-jvm/avian git-subtree-mainline: f978eab8d134c88f88ff67e49458a771c32351db git-subtree-split: 09e4fe60d01f4f4bfb6b2976973bb4913ef61edc
32 lines
784 B
Java
32 lines
784 B
Java
import java.io.IOException;
|
|
|
|
public class Processes {
|
|
public static void main(String[] args) {
|
|
long start = System.currentTimeMillis();
|
|
try {
|
|
final Process p = Runtime.getRuntime().exec("sleep 10");
|
|
new Thread() {
|
|
public void run() {
|
|
try {
|
|
Thread.sleep(100);
|
|
} catch(InterruptedException e) {
|
|
// ignore
|
|
}
|
|
p.destroy();
|
|
}
|
|
}.start();
|
|
try {
|
|
p.waitFor();
|
|
} catch(InterruptedException e) {
|
|
// ignore
|
|
}
|
|
long stop = System.currentTimeMillis();
|
|
if(stop - start > 5000) {
|
|
throw new RuntimeException("test failed; we didn't kill the process...");
|
|
}
|
|
} catch(IOException e) {
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
}
|