use of jetbrains.buildServer.RunBuildException in project teamcity-powershell by JetBrains.
the class PowerShellCommandLineProvider method provideCommandLine.
@NotNull
public List<String> provideCommandLine(@NotNull final PowerShellInfo info, @NotNull final Map<String, String> runnerParams, @NotNull final File scriptFile, final boolean useExecutionPolicy) throws RunBuildException {
final List<String> result = new ArrayList<String>();
final PowerShellExecutionMode mod = PowerShellExecutionMode.fromString(runnerParams.get(RUNNER_EXECUTION_MODE));
if (mod == null) {
throw new RunBuildException("'" + RUNNER_EXECUTION_MODE + "' runner parameter is not defined");
}
// version must be the 1st arg after executable path
addVersion(result, runnerParams, info);
if (!StringUtil.isEmptyOrSpaces(runnerParams.get(RUNNER_NO_PROFILE))) {
result.add("-NoProfile");
}
result.add("-NonInteractive");
addCustomArguments(result, runnerParams, RUNNER_CUSTOM_ARGUMENTS);
if (useExecutionPolicy) {
addExecutionPolicyPreference(result);
}
addScriptBody(result, mod, scriptFile, runnerParams);
return result;
}
use of jetbrains.buildServer.RunBuildException in project teamcity-powershell by JetBrains.
the class PowerShellServiceWindows method generateRunScriptArguments.
@NotNull
private List<String> generateRunScriptArguments(@NotNull final String argumentsToGenerate) throws RunBuildException {
final File bat;
try {
bat = FileUtil.createTempFile(getBuildTempDirectory(), "powershell", ".bat", true);
myFilesToRemove.add(bat);
FileUtil.writeFileAndReportErrors(bat, "@" + argumentsToGenerate);
} catch (IOException e) {
throw new RunBuildException("Failed to generate .bat file");
}
return Arrays.asList("/c", bat.getPath());
}
Aggregations