private static void initializeTerminal() { if (!initialized) { initialized = true; boolean dumb = System.getProperty("java.class.path").contains("idea_rt.jar"); // TODO: Check if other IDEs also have virtual terminals with ANSI color support try { terminal = TerminalBuilder.builder().dumb(dumb).build(); } catch (IllegalStateException e) { LOGGER.warn("Not supported terminal"); LOGGER.debug(e); } catch (IOException e) { LOGGER.error("Failed to init, falling back to STDOUT"); LOGGER.debug(e); } } }
ProgressThread( ProgressState progress, ProgressBarStyle style, long updateInterval, PrintStream consoleStream, String unitName, long unitSize, boolean isSpeedShown ) { this.progress = progress; this.style = style; this.updateInterval = updateInterval; this.consoleStream = consoleStream; this.killed = false; this.unitName = unitName; this.unitSize = unitSize; this.isSpeedShown = isSpeedShown; try { // Issue #42 // Defaulting to a dumb terminal when a supported terminal can not be correctly created // see https://github.com/jline/jline3/issues/291 this.terminal = TerminalBuilder.builder().dumb(true).build(); } catch (IOException ignored) { } if (terminal.getWidth() >= 10) // Workaround for issue #23 under IntelliJ consoleWidth = terminal.getWidth(); }
ProgressThread( ProgressState progress, ProgressBarStyle style, long updateInterval, PrintStream consoleStream, String unitName, long unitSize, boolean isSpeedShown ) { this.progress = progress; this.style = style; this.updateInterval = updateInterval; this.consoleStream = consoleStream; this.killed = false; this.unitName = unitName; this.unitSize = unitSize; this.isSpeedShown = isSpeedShown; try { // Issue #42 // Defaulting to a dumb terminal when a supported terminal can not be correctly created // see https://github.com/jline/jline3/issues/291 this.terminal = TerminalBuilder.builder().dumb(true).build(); } catch (IOException ignored) { } if (terminal.getWidth() >= 10) // Workaround for issue #23 under IntelliJ consoleWidth = terminal.getWidth(); }