Fix passing escaped double quoted spaces to native executables

This commit is contained in:
Douglas Thrift
2016-09-13 13:37:42 -07:00
parent 79ddafcc85
commit 8bca1f50c5
2 changed files with 6 additions and 2 deletions
+2
View File
@@ -4,6 +4,8 @@ Changelog
Unreleased
----------
- Fix passing escaped double quoted spaces to native executables
v6.0.0-alpha.9 - 2016-08-15
---------------------------
@@ -194,11 +194,11 @@ namespace System.Management.Automation
// just the normal double quotes, no other special quotes. Also note that mismatched
// quotes are supported.
bool needQuotes = false;
bool needQuotes = false, followingBackslash = false;
int quoteCount = 0;
for (int i = 0; i < arg.Length; i++)
{
if (arg[i] == '"')
if (arg[i] == '"' && !followingBackslash)
{
quoteCount += 1;
}
@@ -206,6 +206,8 @@ namespace System.Management.Automation
{
needQuotes = true;
}
followingBackslash = arg[i] == '\\';
}
if (needQuotes)