Skip to content

Commit

Permalink
#87 join in method
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Oct 4, 2024
1 parent 290626b commit d91f843
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/main/java/com/yegor256/farea/Farea.java
Original file line number Diff line number Diff line change
Expand Up @@ -204,12 +204,7 @@ public void exec(final String... args) throws IOException {
this.jaxec(args, log);
} finally {
finished.set(true);
try {
terminal.join(10_000L, 0);
} catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
throw new IllegalStateException(ex);
}
Farea.join(terminal);
}
Farea.log("Maven stdout", new String(Files.readAllBytes(log), StandardCharsets.UTF_8));
Farea.log(
Expand Down Expand Up @@ -304,6 +299,19 @@ private static void sleep() {
}
}

/**
* Join this thread.
* @param thread The thread to join
*/
private static void join(final Thread thread) {
try {
thread.join(10_000L, 0);
} catch (final InterruptedException ex) {
Thread.currentThread().interrupt();
throw new IllegalStateException(ex);
}
}

/**
* Execute with command line arguments.
* @return POM
Expand Down

0 comments on commit d91f843

Please sign in to comment.