void () { try { final InputStream stream; if ((stream = connect(port)) == null) { // process terminated prematurely return; } final InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8); final HighlightingProcessHandler process = new HighlightingProcessHandler(reader) { private boolean mySelectionChanged; @Override public void notifyTextAvailable(@NotNull String text, @NotNull Key outputType) { super.notifyTextAvailable(text, outputType); if (mySelectionChanged) { return; } mySelectionChanged = true; myConsole.selectOutputTab(); } }; myConsole.getConsole().attachToProcess(process); process.start(); } catch (UnsupportedEncodingException e) { // cannot happen throw new Error(e); } catch (IOException e) { myStartedProcess.notifyTextAvailable("Could not connect to runner: " + e.toString() + "\n", ProcessOutputTypes.SYSTEM); } }