فهرست منبع

Prevents unnecessary noise log errors on unit tests (#4294)

* Prevents unnecessary noise log errors on unit tests

* Prevent any code in the Peek method
BDisp 1 ماه پیش
والد
کامیت
b6fff43824
1فایلهای تغییر یافته به همراه5 افزوده شده و 0 حذف شده
  1. 5 0
      Terminal.Gui/Drivers/WindowsDriver/WindowsInput.cs

+ 5 - 0
Terminal.Gui/Drivers/WindowsDriver/WindowsInput.cs

@@ -61,6 +61,11 @@ internal class WindowsInput : ConsoleInput<InputRecord>, IWindowsInput
 
     protected override bool Peek ()
     {
+        if (ConsoleDriver.RunningUnitTests)
+        {
+            return false;
+        }
+
         const int bufferSize = 1; // We only need to check if there's at least one event
         nint pRecord = Marshal.AllocHGlobal (Marshal.SizeOf<InputRecord> () * bufferSize);