From ef8a1c60a1c014b1c6deb752154cd77ff5a83c27 Mon Sep 17 00:00:00 2001 From: Robert Holt Date: Wed, 22 Jul 2020 09:42:03 -0700 Subject: [PATCH] Remove PSES force event handling hook --- PSReadLine/ReadLine.cs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/PSReadLine/ReadLine.cs b/PSReadLine/ReadLine.cs index 7942d40a..49170e0e 100644 --- a/PSReadLine/ReadLine.cs +++ b/PSReadLine/ReadLine.cs @@ -197,7 +197,6 @@ internal static PSKeyInfo ReadKey() // - a key is pressed // - the console is exiting // - 300ms - to process events if we're idle - // - processing of events is requested externally // - ReadLine cancellation is requested externally handleId = WaitHandle.WaitAny(_singleton._requestKeyWaitHandles, 300); if (handleId != WaitHandle.WaitTimeout && handleId != EventProcessingRequested) @@ -650,10 +649,6 @@ private PSConsoleReadLine() _savedCurrentLine = new HistoryItem(); _queuedKeys = new Queue(); - // Initialize this event handler early because it could be used by PowerShell - // Editor Services before 'DelayedOneTimeInitialize' runs. - _forceEventWaitHandle = new AutoResetEvent(false); - string hostName = null; // This works mostly by luck - we're not doing anything to guarantee the constructor for our // singleton is called on a thread with a runspace, but it is happening by coincidence. @@ -838,7 +833,7 @@ private void DelayedOneTimeInitialize() _singleton._readKeyWaitHandle = new AutoResetEvent(false); _singleton._keyReadWaitHandle = new AutoResetEvent(false); _singleton._closingWaitHandle = new ManualResetEvent(false); - _singleton._requestKeyWaitHandles = new WaitHandle[] {_singleton._keyReadWaitHandle, _singleton._closingWaitHandle, _defaultCancellationToken.WaitHandle, _singleton._forceEventWaitHandle}; + _singleton._requestKeyWaitHandles = new WaitHandle[] {_singleton._keyReadWaitHandle, _singleton._closingWaitHandle, _defaultCancellationToken.WaitHandle}; _singleton._threadProcWaitHandles = new WaitHandle[] {_singleton._readKeyWaitHandle, _singleton._closingWaitHandle}; // This is for a "being hosted in an alternate appdomain scenario" (the @@ -858,17 +853,6 @@ private void DelayedOneTimeInitialize() _singleton._readKeyThread.Start(); } - /// - /// Used by PowerShellEditorServices to force immediate - /// event handling during the - /// method. This is not a public API, but it is part of a private contract - /// with that project. - /// - private static void ForcePSEventHandling() - { - _singleton._forceEventWaitHandle.Set(); - } - private static void Chord(ConsoleKeyInfo? key = null, object arg = null) { if (!key.HasValue)