private static int runCommand(final ProcessBuilder command) throws IOException, InterruptedException {
command.redirectErrorStream(true);
final Process process = command.start();
- new Thread(new Runnable() {
+ Thread thread = new Thread(new Runnable() {
@Override
public void run() {
try {
throw new RuntimeException(e);
}
}
- },"io test").start();
- return process.waitFor();
+ }, "io test");
+ thread.start();
+ int ret = process.waitFor();
+ thread.join();
+ return ret;
}
public static void assertTimestampsEqual(final long expected, final long actual) {