Added "Log.CloseAndFlush" call before every Environment.Exit

This commit is contained in:
Casper Sparre 2025-10-22 00:52:58 +02:00
parent 0cfac356c5
commit 07aaed9a07

View File

@ -83,6 +83,7 @@ public class Program
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
Log.Error(e, "auth invalid after attempt to get auth from browser"); Log.Error(e, "auth invalid after attempt to get auth from browser");
Log.CloseAndFlush();
Environment.Exit(2); Environment.Exit(2);
} }
@ -95,6 +96,7 @@ public class Program
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
Log.Error("auth invalid after attempt to get auth from browser"); Log.Error("auth invalid after attempt to get auth from browser");
Log.CloseAndFlush();
Environment.Exit(2); Environment.Exit(2);
} }
else else
@ -244,6 +246,8 @@ public class Program
{ {
Console.ReadKey(); Console.ReadKey();
} }
Log.CloseAndFlush();
Environment.Exit(3); Environment.Exit(3);
} }
} }
@ -373,6 +377,8 @@ public class Program
{ {
Console.ReadKey(); Console.ReadKey();
} }
Log.CloseAndFlush();
Environment.Exit(3); Environment.Exit(3);
} }
} }
@ -482,6 +488,8 @@ public class Program
{ {
Console.ReadKey(); Console.ReadKey();
} }
Log.CloseAndFlush();
Environment.Exit(3); Environment.Exit(3);
} }
@ -566,6 +574,8 @@ public class Program
{ {
Console.ReadKey(); Console.ReadKey();
} }
Log.CloseAndFlush();
Environment.Exit(1); Environment.Exit(1);
} }
else else
@ -649,6 +659,7 @@ public class Program
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
Console.ReadKey(); Console.ReadKey();
Log.CloseAndFlush();
Environment.Exit(2); Environment.Exit(2);
} }
@ -665,6 +676,7 @@ public class Program
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
Console.ReadKey(); Console.ReadKey();
Log.CloseAndFlush();
Environment.Exit(2); Environment.Exit(2);
} }
} }
@ -679,6 +691,7 @@ public class Program
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
Console.ReadKey(); Console.ReadKey();
Log.CloseAndFlush();
Environment.Exit(2); Environment.Exit(2);
} }
@ -694,6 +707,7 @@ public class Program
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
Console.ReadKey(); Console.ReadKey();
Log.CloseAndFlush();
Environment.Exit(2); Environment.Exit(2);
} }
} }
@ -723,6 +737,8 @@ public class Program
{ {
Console.ReadKey(); Console.ReadKey();
} }
Log.CloseAndFlush();
Environment.Exit(2); Environment.Exit(2);
} }
} }
@ -811,6 +827,8 @@ public class Program
{ {
Console.ReadKey(); Console.ReadKey();
} }
Log.CloseAndFlush();
Environment.Exit(4); Environment.Exit(4);
} }
@ -867,7 +885,10 @@ public class Program
{ {
AnsiConsole.MarkupLine($"\n[red]Auth failed. Please try again or use other authentication methods detailed here:[/]\n"); AnsiConsole.MarkupLine($"\n[red]Auth failed. Please try again or use other authentication methods detailed here:[/]\n");
AnsiConsole.MarkupLine($"[link]https://docs.ofdl.tools/config/auth[/]\n"); AnsiConsole.MarkupLine($"[link]https://docs.ofdl.tools/config/auth[/]\n");
Console.ReadKey(); Console.ReadKey();
Log.CloseAndFlush();
Environment.Exit(2); Environment.Exit(2);
} }
} }
@ -910,6 +931,7 @@ public class Program
{ {
Console.ReadKey(); Console.ReadKey();
} }
Log.CloseAndFlush(); Log.CloseAndFlush();
Environment.Exit(5); Environment.Exit(5);
} }