@NotNull
  private static Version parseVersion(@NotNull ProcessOutput output) throws VcsException {
    if (output.isTimeout() || (output.getExitCode() != 0) || !output.getStderr().isEmpty()) {
      throw new VcsException(
          String.format(
              "Exit code: %d, Error: %s, Timeout: %b",
              output.getExitCode(), output.getStderr(), output.isTimeout()));
    }

    return parseVersion(output.getStdout());
  }
 public PyExecutionException(
     @NotNull String message,
     @NotNull String command,
     @NotNull List<String> args,
     @NotNull ProcessOutput output) {
   this(
       message,
       command,
       args,
       output.getStdout(),
       output.getStderr(),
       output.getExitCode(),
       Collections.<PyExecutionFix>emptyList());
 }
  @NotNull
  @Override
  protected ProcessOutput getPythonProcessOutput(
      @NotNull String helperPath,
      @NotNull List<String> args,
      boolean askForSudo,
      boolean showProgress,
      @Nullable final String workingDir)
      throws ExecutionException {
    final Sdk sdk = getSdk();
    final String homePath = sdk.getHomePath();
    if (homePath == null) {
      throw new ExecutionException("Cannot find Python interpreter for SDK " + sdk.getName());
    }
    final SdkAdditionalData sdkData = sdk.getSdkAdditionalData();
    if (sdkData instanceof PyRemoteSdkAdditionalDataBase) { // remote interpreter
      final PythonRemoteInterpreterManager manager = PythonRemoteInterpreterManager.getInstance();

      RemoteSdkCredentials remoteSdkCredentials;
      if (CaseCollector.useRemoteCredentials((PyRemoteSdkAdditionalDataBase) sdkData)) {
        try {
          remoteSdkCredentials = ((RemoteSdkAdditionalData) sdkData).getRemoteSdkCredentials(false);
        } catch (InterruptedException e) {
          LOG.error(e);
          remoteSdkCredentials = null;
        } catch (ExecutionException e) {
          throw analyzeException(e, helperPath, args);
        }
        if (manager != null && remoteSdkCredentials != null) {
          if (askForSudo) {
            askForSudo =
                !manager.ensureCanWrite(
                    null, remoteSdkCredentials, remoteSdkCredentials.getInterpreterPath());
          }
        } else {
          throw new PyExecutionException(
              PythonRemoteInterpreterManager.WEB_DEPLOYMENT_PLUGIN_IS_DISABLED, helperPath, args);
        }
      }

      if (manager != null) {
        final List<String> cmdline = new ArrayList<String>();
        cmdline.add(homePath);
        cmdline.add(RemoteFile.detectSystemByPath(homePath).createRemoteFile(helperPath).getPath());
        cmdline.addAll(
            Collections2.transform(
                args,
                new Function<String, String>() {
                  @Override
                  public String apply(@Nullable String input) {
                    return quoteIfNeeded(input);
                  }
                }));
        ProcessOutput processOutput;
        do {
          final PyRemoteSdkAdditionalDataBase remoteSdkAdditionalData =
              (PyRemoteSdkAdditionalDataBase) sdkData;
          final PyRemotePathMapper pathMapper =
              manager.setupMappings(null, remoteSdkAdditionalData, null);
          try {
            processOutput =
                PyRemoteProcessStarterManagerUtil.getManager(remoteSdkAdditionalData)
                    .executeRemoteProcess(
                        null,
                        ArrayUtil.toStringArray(cmdline),
                        workingDir,
                        manager,
                        remoteSdkAdditionalData,
                        pathMapper,
                        askForSudo,
                        true);
          } catch (InterruptedException e) {
            throw new ExecutionException(e);
          }
          if (askForSudo
              && processOutput.getStderr().contains("sudo: 3 incorrect password attempts")) {
            continue;
          }
          break;
        } while (true);
        return processOutput;
      } else {
        throw new PyExecutionException(
            PythonRemoteInterpreterManager.WEB_DEPLOYMENT_PLUGIN_IS_DISABLED, helperPath, args);
      }
    } else {
      throw new PyExecutionException("Invalid remote SDK", helperPath, args);
    }
  }
 @NotNull
 public String getRawError() {
   return myProcessOutput.getStderr();
 }