From 49eefa617df3b890cd99f2a1c3aaf6509c909c3d Mon Sep 17 00:00:00 2001 From: BDisp Date: Wed, 12 Oct 2022 23:46:37 +0100 Subject: [PATCH 1/2] Fixes #2081. Clipboard unit tests sometimes fail with WSL. --- .../ConsoleDrivers/CursesDriver/CursesDriver.cs | 1 + Terminal.Gui/Core/Clipboard/ClipboardBase.cs | 3 ++- Terminal.sln | 1 + testenvironments.json | 15 +++++++++++++++ 4 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 testenvironments.json diff --git a/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs b/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs index b5db7847b..a0837bf35 100644 --- a/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs +++ b/Terminal.Gui/ConsoleDrivers/CursesDriver/CursesDriver.cs @@ -1500,6 +1500,7 @@ namespace Terminal.Gui { } }) { powershell.Start (); + powershell.WaitForExit (); if (!powershell.DoubleWaitForExit ()) { var timeoutError = $@"Process timed out. Command line: bash {powershell.StartInfo.Arguments}. Output: {powershell.StandardOutput.ReadToEnd ()} diff --git a/Terminal.Gui/Core/Clipboard/ClipboardBase.cs b/Terminal.Gui/Core/Clipboard/ClipboardBase.cs index db61af80f..9eb17e174 100644 --- a/Terminal.Gui/Core/Clipboard/ClipboardBase.cs +++ b/Terminal.Gui/Core/Clipboard/ClipboardBase.cs @@ -92,7 +92,8 @@ namespace Terminal.Gui { try { SetClipboardDataImpl (text); return true; - } catch (Exception) { + } catch (Exception ex) { + System.Diagnostics.Debug.WriteLine ($"TrySetClipboardData: {ex.Message}"); return false; } } diff --git a/Terminal.sln b/Terminal.sln index 03b0011e9..29fac1e30 100644 --- a/Terminal.sln +++ b/Terminal.sln @@ -20,6 +20,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .github\workflows\dotnet-core.yml = .github\workflows\dotnet-core.yml .github\workflows\publish.yml = .github\workflows\publish.yml README.md = README.md + testenvironments.json = testenvironments.json EndProjectSection EndProject Global diff --git a/testenvironments.json b/testenvironments.json new file mode 100644 index 000000000..70dbd0b4c --- /dev/null +++ b/testenvironments.json @@ -0,0 +1,15 @@ +{ + "version": "1", + "environments": [ + { + "name": "WSL-Ubuntu", + "type": "wsl", + "wslDistribution": "Ubuntu" + }, + { + "name": "WSL-Debian", + "type": "wsl", + "wslDistribution": "Debian" + } + ] +} \ No newline at end of file From 54934cdc78bf64b958c21a625d4a8dc6800c4514 Mon Sep 17 00:00:00 2001 From: BDisp Date: Thu, 20 Oct 2022 18:43:04 +0100 Subject: [PATCH 2/2] Added some documentation into the testenvironments.json file. --- testenvironments.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/testenvironments.json b/testenvironments.json index 70dbd0b4c..898ac827d 100644 --- a/testenvironments.json +++ b/testenvironments.json @@ -1,4 +1,8 @@ { + // Remote Testing (experimental preview). + // Here is some documentation https://learn.microsoft.com/en-us/visualstudio/test/remote-testing?view=vs-2022. + // Here a screen shot of the VS2022 where are the Test Explorer https://user-images.githubusercontent.com/13117724/196798350-5a6f94d3-b6cd-424e-b4e8-a9b507dc057a.png. + // Ignore "Could not find 'mono' host" error because unit tests don't use the .NET Framework. "version": "1", "environments": [ {