use of com.intellij.execution.Output in project intellij-community by JetBrains.
the class PythonTask method runNoConsole.
/**
* Runs task with out console
* @return stdout
* @throws ExecutionException in case of error. Consider using {@link com.intellij.execution.util.ExecutionErrorDialog}
*/
@NotNull
public final String runNoConsole() throws ExecutionException {
final ProcessHandler process = createProcess(new HashMap<>());
final OutputListener listener = new OutputListener();
process.addProcessListener(listener);
process.startNotify();
process.waitFor(TIMEOUT_TO_WAIT_FOR_TASK);
final Output output = listener.getOutput();
final int exitCode = output.getExitCode();
if (exitCode == 0) {
return output.getStdout();
}
throw new ExecutionException(String.format("Error on python side. " + "Exit code: %s, err: %s out: %s", exitCode, output.getStderr(), output.getStdout()));
}
Aggregations