From d33ddea6d8b93b22baf042ee8f8b1d3d426a9567 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Sun, 22 Oct 2017 01:41:31 -0600 Subject: [PATCH] Attempt to fix issue with stepping in dbgr on Linux Fix #554 --- .../Console/ConsoleReadLine.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/PowerShellEditorServices/Console/ConsoleReadLine.cs b/src/PowerShellEditorServices/Console/ConsoleReadLine.cs index d2e77c332..a277f9bf3 100644 --- a/src/PowerShellEditorServices/Console/ConsoleReadLine.cs +++ b/src/PowerShellEditorServices/Console/ConsoleReadLine.cs @@ -487,6 +487,19 @@ private async Task ReadKeyAsync(CancellationToken cancellationTo } else { + // Check to see if a key is available. + // If not check for cancellation requested. + while (!Console.KeyAvailable) + { + if (cancellationToken.IsCancellationRequested) + { + //this.bufferedKey = keyInfo; + throw new TaskCanceledException(); + } + + Thread.Sleep(100); + } + keyInfo = Console.ReadKey(true); if (cancellationToken.IsCancellationRequested)