Skip to content

Commit fac5e9e

Browse files
Cristian PopCIPop
authored andcommitted
Catching all exceptions in Main to ensure the log is properly flushed before exiting the process.
1 parent e5aa9ea commit fac5e9e

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

e2e/stress/IoTClientPerf/Program.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,13 +248,16 @@ public static int Main(string[] args)
248248
{
249249
ret = runner.RunTestAsync().GetAwaiter().GetResult();
250250
}
251-
finally
251+
catch (Exception ex)
252252
{
253-
Console.Write("Writing output . . . ");
254-
resultWriter.FlushAsync().GetAwaiter().GetResult();
255-
Console.WriteLine("OK");
253+
Console.WriteLine(ex);
254+
ret = -1;
256255
}
257256

257+
Console.Write("Writing output . . . ");
258+
resultWriter.FlushAsync().GetAwaiter().GetResult();
259+
Console.WriteLine("OK");
260+
258261
if (ret == 0)
259262
{
260263
Console.WriteLine("Test PASSED.");

0 commit comments

Comments
 (0)