forked from sim0n00ps/OF-DL
Attempt to fix logging not flushing correctly before exiting
This commit is contained in:
parent
e6a3eea243
commit
6797833149
@ -83,8 +83,7 @@ public class Program
|
||||
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
|
||||
Log.Error(e, "auth invalid after attempt to get auth from browser");
|
||||
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(2);
|
||||
ExitWithCode(2);
|
||||
}
|
||||
|
||||
if (auth == null)
|
||||
@ -96,8 +95,7 @@ public class Program
|
||||
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
|
||||
Log.Error("auth invalid after attempt to get auth from browser");
|
||||
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(2);
|
||||
ExitWithCode(2);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -253,8 +251,7 @@ public class Program
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(3);
|
||||
ExitWithCode(3);
|
||||
}
|
||||
}
|
||||
|
||||
@ -384,8 +381,7 @@ public class Program
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(3);
|
||||
ExitWithCode(3);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -497,8 +493,7 @@ public class Program
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(3);
|
||||
ExitWithCode(3);
|
||||
}
|
||||
|
||||
|
||||
@ -593,8 +588,7 @@ public class Program
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(1);
|
||||
ExitWithCode(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -691,8 +685,7 @@ public class Program
|
||||
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
|
||||
|
||||
Console.ReadKey();
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(2);
|
||||
ExitWithCode(2);
|
||||
}
|
||||
|
||||
|
||||
@ -708,8 +701,7 @@ public class Program
|
||||
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
|
||||
|
||||
Console.ReadKey();
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(2);
|
||||
ExitWithCode(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -723,8 +715,7 @@ public class Program
|
||||
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
|
||||
|
||||
Console.ReadKey();
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(2);
|
||||
ExitWithCode(2);
|
||||
}
|
||||
|
||||
if (!config!.DisableBrowserAuth)
|
||||
@ -739,8 +730,7 @@ public class Program
|
||||
AnsiConsole.MarkupLine($"[red]Press any key to exit.[/]");
|
||||
|
||||
Console.ReadKey();
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(2);
|
||||
ExitWithCode(2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -770,8 +760,7 @@ public class Program
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(2);
|
||||
ExitWithCode(2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -915,8 +904,7 @@ public class Program
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(4);
|
||||
ExitWithCode(4);
|
||||
}
|
||||
|
||||
if (!File.Exists(Path.Join(WidevineClient.Widevine.Constants.DEVICES_FOLDER, WidevineClient.Widevine.Constants.DEVICE_NAME, "device_client_id_blob")))
|
||||
@ -975,8 +963,7 @@ public class Program
|
||||
|
||||
Console.ReadKey();
|
||||
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(2);
|
||||
ExitWithCode(2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1019,8 +1006,7 @@ public class Program
|
||||
Console.ReadKey();
|
||||
}
|
||||
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(5);
|
||||
ExitWithCode(5);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -3690,7 +3676,7 @@ public class Program
|
||||
AnsiConsole.Markup($"[red]{settingName} is not unique enough, please make sure you include either '{{mediaId}}' or '{{filename}}' to ensure that files are not overwritten with the same filename.[/]\n");
|
||||
AnsiConsole.Markup("[red]Press any key to continue.[/]\n");
|
||||
Console.ReadKey();
|
||||
Environment.Exit(2);
|
||||
ExitWithCode(2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3719,8 +3705,13 @@ public class Program
|
||||
AnsiConsole.Markup($"[green]Other OF DL process detected, exiting..\n[/]");
|
||||
Log.Warning("Other OF DL process detected, exiting..");
|
||||
|
||||
ExitWithCode(0);
|
||||
}
|
||||
|
||||
static void ExitWithCode(int exitCode)
|
||||
{
|
||||
Log.CloseAndFlush();
|
||||
Environment.Exit(0);
|
||||
Environment.Exit(exitCode);
|
||||
}
|
||||
|
||||
static ILogger LoggerWithConfigContext(Entities.Config config)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user