(String[] args)
| 2 | |
| 3 | public class Processes { |
| 4 | public static void main(String[] args) { |
| 5 | long start = System.currentTimeMillis(); |
| 6 | try { |
| 7 | final Process p = Runtime.getRuntime().exec("sleep 10"); |
| 8 | new Thread() { |
| 9 | public void run() { |
| 10 | try { |
| 11 | Thread.sleep(100); |
| 12 | } catch(InterruptedException e) { |
| 13 | // ignore |
| 14 | } |
| 15 | p.destroy(); |
| 16 | } |
| 17 | }.start(); |
| 18 | try { |
| 19 | p.waitFor(); |
| 20 | } catch(InterruptedException e) { |
| 21 | // ignore |
| 22 | } |
| 23 | long stop = System.currentTimeMillis(); |
| 24 | if(stop - start > 5000) { |
| 25 | throw new RuntimeException("test failed; we didn't kill the process..."); |
| 26 | } |
| 27 | } catch(IOException e) { |
| 28 | throw new RuntimeException(e); |
| 29 | } |
| 30 | } |
| 31 | } |
nothing calls this directly
no test coverage detected