Import PSReadLine change to throw when redirected

A similar change was made to the Source Depot fork of PSReadLine, and
the behavior is depended on in the ConsoleHost. The host always attempts
to load PSReadLine, because a future version of PSReadLine will support
redirected input/output, and until then, PSReadLine must throw so that
the host correctly falls back to Console.ReadLine().
This commit is contained in:
Andrew Schwartzmeyer
2016-07-01 14:36:15 -07:00
parent 75777b42ee
commit c5df728176
@@ -258,6 +258,14 @@ namespace Microsoft.PowerShell
public static string ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)
{
var console = _singleton._console;
// If either stdin or stdout is redirected, PSReadline doesn't really work, so throw
// and let PowerShell call Console.ReadLine or do whatever else it decides to do.
if (Console.IsInputRedirected || Console.IsOutputRedirected)
{
throw new NotSupportedException();
}
#if CORECLR
_singleton._prePSReadlineControlCMode = Console.TreatControlCAsInput;
#else