private ConsoleReader createAnsiWindowsReader() throws Exception {
// Get decorated OutputStream that parses ANSI-codes
final PrintStream ansiOut = (PrintStream) ClassUtils
.getClass(JLineShell.class.getClassLoader(),
ANSI_CONSOLE_CLASSNAME).getMethod("out").invoke(null);
final WindowsTerminal ansiTerminal = new WindowsTerminal() {
@Override
public boolean isANSISupported() {
return true;
}
};
ansiTerminal.initializeTerminal();
// Make sure to reset the original shell's colors on shutdown by closing
// the stream
statusListener = new ShellStatusListener() {
public void onShellStatusChange(final ShellStatus oldStatus,
final ShellStatus newStatus) {