Skip to content

Commit 7fab6d8

Browse files
author
Robert Holt
committed
Fix git idiocy
1 parent 063b782 commit 7fab6d8

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/PowerShellEditorServices/Session/PowerShellContext.cs

+8-7
Original file line numberDiff line numberDiff line change
@@ -769,8 +769,7 @@ await this.ExecuteCommand<object>(
769769
/// <returns>A Task that can be awaited for completion.</returns>
770770
public async Task ExecuteScriptWithArgs(string script, string arguments = null, bool writeInputToHost = false)
771771
{
772-
string reportedScript = script;
773-
string escapedScriptPath = PowerShellContext.WildcardEscapePath(script);
772+
var escapedScriptPath = new StringBuilder(PowerShellContext.WildcardEscapePath(script));
774773
PSCommand command = new PSCommand();
775774

776775
if (arguments != null)
@@ -798,16 +797,18 @@ public async Task ExecuteScriptWithArgs(string script, string arguments = null,
798797
if (File.Exists(script) || File.Exists(scriptAbsPath))
799798
{
800799
// Dot-source the launched script path
801-
escapedScriptPath = ". " + QuoteEscapeString(escapedScriptPath);
800+
string escapedFilePath = escapedScriptPath.ToString();
801+
escapedScriptPath = new StringBuilder(". ").Append(QuoteEscapeString(escapedFilePath));
802802
}
803803

804-
reportedScript += " " + arguments;
805-
escapedScriptPath = escapedScriptPath + " " + arguments;
806-
command.AddScript(escapedScriptPath, false);
804+
// Add arguments
805+
escapedScriptPath.Append(' ').Append(arguments);
806+
807+
command.AddScript(escapedScriptPath.ToString(), false);
807808
}
808809
else
809810
{
810-
command.AddCommand(escapedScriptPath, false);
811+
command.AddCommand(escapedScriptPath.ToString(), false);
811812
}
812813

813814
if (writeInputToHost)

0 commit comments

Comments
 (0)