Skip to content

Commit bc52e2e

Browse files
oehmegnodet
andauthored
[#11048] Fix race condition in MessageUtils (#11049)
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. Co-authored-by: Guillaume Nodet <[email protected]>
1 parent 2b7bb9c commit bc52e2e

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 fastTerminal) {
98+
// wait for the asynchronous systemInstall call before we uninstall to ensure a consistent state
99+
fastTerminal.getTerminal();
100+
}
97101
AnsiConsole.systemUninstall();
98102
} finally {
99103
terminal = null;

0 commit comments

Comments
 (0)