mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Fix $PSNativeCommandArgPassing = Windows to handle empty args correctly (#16639)
This commit is contained in:
1 parent
e2f39fa0eb
commit
0f21156dee
2 files changed
+25
-3
No files matched your search
@@ -314,7 +314,7 @@ namespace System.Management.Automation
|
||||
}
|
||||
else
|
||||
{
|
||||
if (argArrayAst != null && ArgumentPassingStyle == NativeArgumentPassingStyle.Standard)
|
||||
if (argArrayAst != null && ArgumentPassingStyle != NativeArgumentPassingStyle.Legacy)
|
||||
{
|
||||
// We have a literal array, so take the extent, break it on spaces and add them to the argument list.
|
||||
foreach (string element in argArrayAst.Extent.Text.Split(' ', StringSplitOptions.RemoveEmptyEntries))
|
||||
@@ -331,7 +331,7 @@ namespace System.Management.Automation
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (ArgumentPassingStyle == NativeArgumentPassingStyle.Standard && currentObj != null)
|
||||
else if (ArgumentPassingStyle != NativeArgumentPassingStyle.Legacy && currentObj != null)
|
||||
{
|
||||
// add empty strings to arglist, but not nulls
|
||||
AddToArgumentList(parameter, arg);
|
||||
|
||||
Reference in new issue
Block a user