示例#1
0
  private ExitCodeAndStdOut processJsonConfig(File jsonTempFile) throws IOException {
    final ImmutableList<String> args =
        ImmutableList.of("python", PATH_TO_INTELLIJ_PY, jsonTempFile.getAbsolutePath());

    ShellStep command =
        new ShellStep() {

          @Override
          public String getShortName(ExecutionContext context) {
            return "python";
          }

          @Override
          protected ImmutableList<String> getShellCommandInternal(ExecutionContext context) {
            return args;
          }

          @Override
          protected boolean shouldRecordStdout() {
            return true;
          }
        };

    int exitCode = command.execute(executionContext);
    return new ExitCodeAndStdOut(exitCode, command.getStdOut());
  }
示例#2
0
  private ExitCodeAndOutput processJsonConfig(File jsonTempFile, boolean generateMinimalProject)
      throws IOException {
    ImmutableList.Builder<String> argsBuilder =
        ImmutableList.<String>builder()
            .add(pythonInterpreter)
            .add(PATH_TO_INTELLIJ_PY)
            .add(jsonTempFile.getAbsolutePath());

    if (generateMinimalProject) {
      argsBuilder.add("--generate_minimum_project");
    }

    final ImmutableList<String> args = argsBuilder.build();

    ShellStep command =
        new ShellStep() {

          @Override
          public String getShortName() {
            return "python";
          }

          @Override
          protected ImmutableList<String> getShellCommandInternal(ExecutionContext context) {
            return args;
          }
        };

    Console console = executionContext.getConsole();
    Console childConsole =
        new Console(Verbosity.SILENT, console.getStdOut(), console.getStdErr(), Ansi.withoutTty());
    ExecutionContext childContext =
        ExecutionContext.builder()
            .setExecutionContext(executionContext)
            .setConsole(childConsole)
            .build();
    int exitCode = command.execute(childContext);
    return new ExitCodeAndOutput(exitCode, command.getStdout(), command.getStderr());
  }