mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Fix argument passing in GlobalToolShim (#21333)
This commit is contained in:
@@ -30,9 +30,10 @@ namespace Microsoft.PowerShell.GlobalTool.Shim
|
||||
|
||||
string platformFolder = isWindows ? WinFolderName : UnixFolderName;
|
||||
|
||||
string argsString = args.Length > 0 ? string.Join(" ", args) : null;
|
||||
var arguments = new List<string>(args.Length + 1);
|
||||
var pwshPath = Path.Combine(currentPath, platformFolder, PwshDllName);
|
||||
string processArgs = string.IsNullOrEmpty(argsString) ? $"\"{pwshPath}\"" : $"\"{pwshPath}\" {argsString}";
|
||||
arguments.Add(pwshPath);
|
||||
arguments.AddRange(args);
|
||||
|
||||
if (File.Exists(pwshPath))
|
||||
{
|
||||
@@ -41,7 +42,7 @@ namespace Microsoft.PowerShell.GlobalTool.Shim
|
||||
e.Cancel = true;
|
||||
};
|
||||
|
||||
var process = System.Diagnostics.Process.Start("dotnet", processArgs);
|
||||
var process = System.Diagnostics.Process.Start("dotnet", arguments);
|
||||
process.WaitForExit();
|
||||
return process.ExitCode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user