mirror of
https://github.com/PowerShell/PowerShell.git
synced 2024-11-23 17:53:58 +08:00
Fix argument passing in GlobalToolShim
(#21333)
This commit is contained in:
parent
6253933501
commit
ff3c847898
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user