Skip to content

Commit c43fce7

Browse files
ForNeVeRchrisdent-de
authored andcommitted
Fix argument passing in GlobalToolShim (PowerShell#21333)
1 parent 0652d48 commit c43fce7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/Microsoft.PowerShell.GlobalTool.Shim/GlobalToolShim.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ public static int Main(string[] args)
3030

3131
string platformFolder = isWindows ? WinFolderName : UnixFolderName;
3232

33-
string argsString = args.Length > 0 ? string.Join(" ", args) : null;
33+
var arguments = new List<string>(args.Length + 1);
3434
var pwshPath = Path.Combine(currentPath, platformFolder, PwshDllName);
35-
string processArgs = string.IsNullOrEmpty(argsString) ? $"\"{pwshPath}\"" : $"\"{pwshPath}\" {argsString}";
35+
arguments.Add(pwshPath);
36+
arguments.AddRange(args);
3637

3738
if (File.Exists(pwshPath))
3839
{
@@ -41,7 +42,7 @@ public static int Main(string[] args)
4142
e.Cancel = true;
4243
};
4344

44-
var process = System.Diagnostics.Process.Start("dotnet", processArgs);
45+
var process = System.Diagnostics.Process.Start("dotnet", arguments);
4546
process.WaitForExit();
4647
return process.ExitCode;
4748
}

0 commit comments

Comments
 (0)