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

This commit is contained in:
Casper Sparre 2025-10-22 00:52:58 +02:00
parent 23f98a4c8e
commit a467e6f8b7

View File

@ -83,7 +83,8 @@ public class Program
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
Log.Error(e, "auth invalid after attempt to get auth from browser");
Environment.Exit(2);
Log.CloseAndFlush();
Environment.Exit(2);
}
if (auth == null)
@ -95,7 +96,8 @@ public class Program
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
Log.Error("auth invalid after attempt to get auth from browser");
Environment.Exit(2);
Log.CloseAndFlush();
Environment.Exit(2);
}
else
{
@ -250,6 +252,8 @@ public class Program
{
Console.ReadKey();
}
Log.CloseAndFlush();
Environment.Exit(3);
}
}
@ -379,7 +383,9 @@ public class Program
{
Console.ReadKey();
}
Environment.Exit(3);
Log.CloseAndFlush();
Environment.Exit(3);
}
}
else
@ -490,7 +496,9 @@ public class Program
{
Console.ReadKey();
}
Environment.Exit(3);
Log.CloseAndFlush();
Environment.Exit(3);
}
@ -574,7 +582,9 @@ public class Program
{
Console.ReadKey();
}
Environment.Exit(1);
Log.CloseAndFlush();
Environment.Exit(1);
}
else
{
@ -671,7 +681,8 @@ public class Program
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
Console.ReadKey();
Environment.Exit(2);
Log.CloseAndFlush();
Environment.Exit(2);
}
@ -687,6 +698,7 @@ public class Program
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
Console.ReadKey();
Log.CloseAndFlush();
Environment.Exit(2);
}
}
@ -701,7 +713,8 @@ public class Program
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
Console.ReadKey();
Environment.Exit(2);
Log.CloseAndFlush();
Environment.Exit(2);
}
if (!config!.DisableBrowserAuth)
@ -716,6 +729,7 @@ public class Program
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
Console.ReadKey();
Log.CloseAndFlush();
Environment.Exit(2);
}
}
@ -745,7 +759,9 @@ public class Program
{
Console.ReadKey();
}
Environment.Exit(2);
Log.CloseAndFlush();
Environment.Exit(2);
}
}
@ -888,7 +904,9 @@ public class Program
{
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")))
@ -944,9 +962,12 @@ public class Program
{
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");
Console.ReadKey();
Console.ReadKey();
Log.CloseAndFlush();
Environment.Exit(2);
}
}
}
Log.Information("Logged In successfully as {Name:l} ({Username:l})", validate.name, validate.username);
@ -987,6 +1008,7 @@ public class Program
{
Console.ReadKey();
}
Log.CloseAndFlush();
Environment.Exit(5);
}