Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Powershell -file doesn't handle arguments that are string[] #260

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion project/core/tasks/PowerShellTask.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,16 @@ public string SuccessExitCodes
[ReflectorProperty("buildTimeoutSeconds", Required = false)]
public int BuildTimeoutSeconds { get; set; }

/// <summary>
/// CCnet 1.8 always uses -File for execution, this means that if you want to pass an array
/// of strings as an argument it screws it up, I'm adding the ability to use -Command which
/// will behave as the user expects, however this will optional for backwards compatibility
/// </summary>
/// <version>1.8</version>
/// <default>false</default>
[ReflectorProperty("useCommandExecution", Required = false)]
public bool UseCommandExecution { get; set; }

/// <summary>
/// Run the specified PowerShell and add its output to the build results.
/// </summary>
Expand Down Expand Up @@ -395,7 +405,7 @@ private string Args(IIntegrationResult result)
builder.AppendArgument("-NoProfile");
builder.AppendArgument("-NonInteractive");

builder.AppendArgument("-file");
builder.AppendArgument(UseCommandExecution ? "-command" : "-file");

if (!string.IsNullOrEmpty(Script))
{
Expand Down