Skip to content

Commit

Permalink
[MNG-6380] Upgrade to Jansi 2.1.0 and use the new AnsiMode to control…
Browse files Browse the repository at this point in the history
… the whether ansi sequences are stripped or let through
  • Loading branch information
gnodet committed Dec 8, 2020
1 parent 360fd97 commit 9423804
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<version>2.0.1</version>
<version>2.1.0</version>
<optional>true</optional>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import org.fusesource.jansi.Ansi;
import org.fusesource.jansi.AnsiConsole;
import org.fusesource.jansi.AnsiMode;

/**
* Colored message utils, to manage colors consistently across plugins (only if Maven version is at least 3.5.0).
Expand Down Expand Up @@ -81,17 +82,13 @@ public static void systemUninstall()
// hook can only set when JANSI is true
if ( shutdownHook != null )
{
// if out and system_out are same instance again, ansi is assumed to be uninstalled
if ( AnsiConsole.out == AnsiConsole.system_out )
try
{
try
{
Runtime.getRuntime().removeShutdownHook( shutdownHook );
}
catch ( IllegalStateException ex )
{
// ignore - VM is already shutting down
}
Runtime.getRuntime().removeShutdownHook( shutdownHook );
}
catch ( IllegalStateException ex )
{
// ignore - VM is already shutting down
}
}
}
Expand All @@ -113,6 +110,7 @@ public static void setColorEnabled( boolean flag )
{
if ( JANSI )
{
AnsiConsole.out().setMode( flag ? AnsiMode.Force : AnsiMode.Strip );
Ansi.setEnabled( flag );
}
}
Expand Down Expand Up @@ -194,7 +192,10 @@ public void run()
{
synchronized ( STARTUP_SHUTDOWN_MONITOR )
{
doSystemUninstall();
while ( AnsiConsole.isInstalled() )
{
doSystemUninstall();
}
}
}
};
Expand Down

0 comments on commit 9423804

Please sign in to comment.