corda/sgx-jvm/avian/test/Processes.java
Andras Slemmer 9bb3d6b972 Add 'sgx-jvm/avian/' from commit '09e4fe60d01f4f4bfb6b2976973bb4913ef61edc'
git-subtree-dir: sgx-jvm/avian
git-subtree-mainline: f978eab8d1
git-subtree-split: 09e4fe60d0
2017-03-13 12:18:24 +00:00

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);
}
}
}