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

This commit is contained in:
Casper Sparre 2025-10-22 00:52:58 +02:00
parent 5f1870f32f
commit 95438ad538

View File

@ -83,7 +83,8 @@ 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");
Environment.Exit(2); Log.CloseAndFlush();
Environment.Exit(2);
} }
if (auth == null) if (auth == null)
@ -95,7 +96,8 @@ 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");
Environment.Exit(2); Log.CloseAndFlush();
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,7 +377,9 @@ public class Program
{ {
Console.ReadKey(); Console.ReadKey();
} }
Environment.Exit(3);
Log.CloseAndFlush();
Environment.Exit(3);
} }
} }
else else
@ -482,7 +488,9 @@ public class Program
{ {
Console.ReadKey(); Console.ReadKey();
} }
Environment.Exit(3);
Log.CloseAndFlush();
Environment.Exit(3);
} }
@ -566,7 +574,9 @@ public class Program
{ {
Console.ReadKey(); Console.ReadKey();
} }
Environment.Exit(1);
Log.CloseAndFlush();
Environment.Exit(1);
} }
else else
{ {
@ -649,7 +659,8 @@ public class Program
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
Console.ReadKey(); Console.ReadKey();
Environment.Exit(2); Log.CloseAndFlush();
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,7 +691,8 @@ public class Program
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]"); AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
Console.ReadKey(); Console.ReadKey();
Environment.Exit(2); Log.CloseAndFlush();
Environment.Exit(2);
} }
if (!config!.DisableBrowserAuth) if (!config!.DisableBrowserAuth)
@ -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,7 +737,9 @@ public class Program
{ {
Console.ReadKey(); Console.ReadKey();
} }
Environment.Exit(2);
Log.CloseAndFlush();
Environment.Exit(2);
} }
} }
@ -811,7 +827,9 @@ public class Program
{ {
Console.ReadKey(); Console.ReadKey();
} }
Environment.Exit(4);
Log.CloseAndFlush();
Environment.Exit(4);
} }
if (!File.Exists(Path.Join(WidevineClient.Widevine.Constants.DEVICES_FOLDER, WidevineClient.Widevine.Constants.DEVICE_NAME, "device_client_id_blob"))) if (!File.Exists(Path.Join(WidevineClient.Widevine.Constants.DEVICES_FOLDER, WidevineClient.Widevine.Constants.DEVICE_NAME, "device_client_id_blob")))
@ -867,9 +885,12 @@ 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);
} }
} }
Log.Information("Logged In successfully as {Name:l} ({Username:l})", validate.name, validate.username); Log.Information("Logged In successfully as {Name:l} ({Username:l})", validate.name, validate.username);
@ -910,6 +931,7 @@ public class Program
{ {
Console.ReadKey(); Console.ReadKey();
} }
Log.CloseAndFlush(); Log.CloseAndFlush();
Environment.Exit(5); Environment.Exit(5);
} }