private void configureOSTerminal() throws IOException { if (OSUtils.isLinux() || OSUtils.isOSX()) { TerminalFactory.configure(TerminalFactory.Type.UNIX); TerminalFactory.reset(); } else if (OSUtils.isWindows()) { TerminalFactory.configure(TerminalFactory.Type.WINDOWS); TerminalFactory.reset(); } else { TerminalFactory.configure(TerminalFactory.Type.NONE); TerminalFactory.reset(); } initReaderAndStreams(); }
@Override public void setAnsiSupported(final boolean value) { if (value != isAnsiSupported()) { try { if (value) { configureOSTerminal(); } else { TerminalFactory.configure(TerminalFactory.Type.NONE); TerminalFactory.reset(); } initReaderAndStreams(); } catch (IOException e) { throw new RuntimeException("Failed to reset Terminal instance for ANSI configuration", e); } } }