private void addScriptBody()

in powershell-agent/src/main/java/jetbrains/buildServer/powershell/agent/PowerShellCommandLineProvider.java [111:134]


  private void addScriptBody(@NotNull final List<String> args,
                             @NotNull final PowerShellExecutionMode mod,
                             @NotNull final File scriptFile,
                             @NotNull final Map<String, String> runnerParams,
                             @NotNull final Map<String, String> sharedConfigParams) throws RunBuildException {
    switch (mod) {
      case STDIN:
        args.add("-Command");
        args.add("-");
        args.add("<");
        args.add(scriptFile.getPath());
        break;
      case PS1:
        if (!scriptFile.getPath().toLowerCase().endsWith(".ps1")) {
          throw new RunBuildException("PowerShell script should have '.ps1' extension");
        }
        args.add("-File");
        args.add(scriptFile.getPath());
        addCustomArguments(args, runnerParams, sharedConfigParams, RUNNER_SCRIPT_ARGUMENTS);
        break;
      default:
        throw new RunBuildException("Unknown ExecutionMode: " + mod);
    }
  }