void (@NotNull ProgressIndicator indicator) { final CapturingProcessHandler handler = new CapturingProcessHandler(process, commandLine.getCharset(), commandLine.getCommandLineString()); handler.addProcessListener(new ProcessAdapter() { @Override public void onTextAvailable(@NotNull ProcessEvent event, @NotNull Key outputType) { if (outputType == ProcessOutputTypes.STDOUT || outputType == ProcessOutputTypes.STDERR) { for (String line : StringUtil.splitByLines(event.getText())) { if (isSignificantOutput(line)) { indicator.setText2(line.trim()); //NON-NLS } } } } private static boolean isSignificantOutput(String line) { return line.trim().length() > 3; } }); final ProcessOutput result = handler.runProcessWithProgressIndicator(indicator); final int exitCode = result.getExitCode(); if (exitCode != 0) { final String message = StringUtil.isEmptyOrSpaces(result.getStdout()) && StringUtil.isEmptyOrSpaces(result.getStderr()) ? PyBundle.message("debugger.cython.extension.permission.denied") : PyBundle.message("debugger.cython.extension.non.zero.exit.code", exitCode, result.getStderr()); UIUtil.invokeLaterIfNeeded(() -> showClearErrorMessage(message, project)); } }