Skip to content

Commit 6fd1a05

Browse files
committed
[#11048] Fix race condition in MessageUtils
Wait for the AnsiConsole#systemInstall call in the FastTerminal background thread before uninstalling. Otherwise a quickly finishing build might leave the terminal and system streams in a broken state.
1 parent ec56597 commit 6fd1a05

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

impl/maven-jline/src/main/java/org/apache/maven/jline/MessageUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ public static void systemUninstall() {
9494

9595
private static void doSystemUninstall() {
9696
try {
97+
if (terminal instanceof FastTerminal) {
98+
//wait for the asynchronous systemInstall call before we uninstall to ensure a consistent state
99+
((FastTerminal) terminal).getTerminal();
100+
}
97101
AnsiConsole.systemUninstall();
98102
} finally {
99103
terminal = null;

0 commit comments

Comments
 (0)