From 10625c3a9199523fd0a963a9e369a886b30e9fae Mon Sep 17 00:00:00 2001 From: James Truher Date: Tue, 16 May 2017 15:06:35 -0700 Subject: [PATCH] fix for issue #3183, honor NoEcho on OSX This does not provide support for IncludeKeyDown or IncludeKeyUp, but does not echo the character when provided. In order to support IncludeKeyDown and IncludeKeyUp a more substantial rewrite will be needed as Console.ReadKey doesn't support this behavior. This applies to both OSX and Linux. --- .../host/msh/ConsoleHostRawUserInterface.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs index e90f132094c..16cb2fd42d0 100644 --- a/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs +++ b/src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHostRawUserInterface.cs @@ -1745,10 +1745,10 @@ public override string ToString() /// from the keyboard device, blocking processing until a keystroke is /// typed that matches the specified keystroke options. /// - /// Unused + /// Only NoEcho is supported. public override KeyInfo ReadKey(ReadKeyOptions options) { - ConsoleKeyInfo key = Console.ReadKey(); + ConsoleKeyInfo key = Console.ReadKey((options & ReadKeyOptions.NoEcho) != 0); return new KeyInfo((int)key.Key, key.KeyChar, new ControlKeyStates(), true); }