@Override public int waitFor() throws InterruptedException { if (exitValue == Integer.MIN_VALUE) { exitValue = CSystem.INSTANCE.pclose(fd); if (exitValue == -1) { throw new RuntimeException("Failed to close process."); } } return exitValue; }