mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 04:36:39 +00:00
Fix multi-line input w/ redirected stdin (#2090)
The input loop reading from stdin did not handle multi-line input correctly because it was adding a newline character where none was expected. The fix was to not include the final newline character to accept input, just like Console.ReadLine or PSReadline would.
This commit is contained in:
1 parent
22aac12c3e
commit
cf18010ad5
2 files changed
+22
-8
No files matched your search
@@ -1557,6 +1557,7 @@ namespace Microsoft.PowerShell
|
||||
if (initialContent != null)
|
||||
{
|
||||
sb.Append(initialContent);
|
||||
sb.Append('\n');
|
||||
}
|
||||
|
||||
while (true)
|
||||
@@ -1579,7 +1580,11 @@ namespace Microsoft.PowerShell
|
||||
if (!NoPrompt) Console.Out.Write('\n');
|
||||
Console.In.Read();
|
||||
}
|
||||
sb.Append('\n');
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '\n')
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1591,12 +1596,6 @@ namespace Microsoft.PowerShell
|
||||
{
|
||||
sb.Append(c);
|
||||
}
|
||||
|
||||
|
||||
if (c == '\n')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
|
||||
Reference in new issue
Block a user