Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/guiunit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <llsan@microsoft.com>2021-05-19 12:07:51 +0300
committerLluis Sanchez <llsan@microsoft.com>2021-05-19 12:07:51 +0300
commitc3864e447faf2c3f6488358af4077eaf4cc0184d (patch)
tree5a0fa89493117296da0cf1a5f448b6e7f9f742c8 /src/framework/GuiUnit/TestRunner.cs
parentc2cd748ef51748c77d560ca393ce79e5f5f3b1c3 (diff)
Report exit code when shutting down toolkit
That's required for Xamarin.Mac, since it needs to call exit(code) to report the code
Diffstat (limited to 'src/framework/GuiUnit/TestRunner.cs')
-rw-r--r--src/framework/GuiUnit/TestRunner.cs49
1 files changed, 31 insertions, 18 deletions
diff --git a/src/framework/GuiUnit/TestRunner.cs b/src/framework/GuiUnit/TestRunner.cs
index fb8d3a2..996bc42 100644
--- a/src/framework/GuiUnit/TestRunner.cs
+++ b/src/framework/GuiUnit/TestRunner.cs
@@ -82,6 +82,8 @@ namespace GuiUnit
private ITestAssemblyRunner runner;
+ private bool finished;
+
#region Constructors
/// <summary>
@@ -228,7 +230,8 @@ namespace GuiUnit
} catch (Exception ex) {
Console.WriteLine ("Unexpected error while running the tests: {0}", ex);
} finally {
- Shutdown ();
+ FinishTestExecution();
+ Shutdown();
}
});
MainLoop.RunMainLoop ();
@@ -246,24 +249,34 @@ namespace GuiUnit
ExitCode = 1;
}
finally
- {
- if (commandLineOptions.OutFile == null)
- {
- if (commandLineOptions.Wait)
- {
- Console.WriteLine("Press Enter key to continue . . .");
- Console.ReadLine();
- }
- }
- else
- {
- writer.Close();
- }
- }
- }
+ {
+ FinishTestExecution();
+ }
+ }
}
- static void Shutdown ()
+ private void FinishTestExecution()
+ {
+ if (finished)
+ return;
+
+ finished = true;
+
+ if (commandLineOptions.OutFile == null)
+ {
+ if (commandLineOptions.Wait)
+ {
+ Console.WriteLine("Press Enter key to continue . . .");
+ Console.ReadLine();
+ }
+ }
+ else
+ {
+ writer.Close();
+ }
+ }
+
+ static void Shutdown ()
{
// Run the shutdown method on the main thread
var helper = new InvokerHelper {
@@ -275,7 +288,7 @@ namespace GuiUnit
Console.WriteLine ("Unexpected error during `BeforeShutdown`: {0}", ex);
ExitCode = 1;
} finally {
- MainLoop.Shutdown ();
+ MainLoop.Shutdown (ExitCode);
}
return null;
}