mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-30 13:05:25 -05:00
feat: log exit tasks to console (#1363)
This commit is contained in:
@@ -12,6 +12,11 @@ namespace hex::init {
|
||||
bool async;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Runs the exit tasks and print them to console
|
||||
*/
|
||||
void runExitTasks();
|
||||
|
||||
std::vector<Task> getInitTasks();
|
||||
std::vector<Task> getExitTasks();
|
||||
}
|
||||
@@ -76,8 +76,7 @@ namespace hex::crash {
|
||||
EventManager::post<EventAbnormalTermination>(signalNumber);
|
||||
|
||||
// Run exit tasks
|
||||
for (const auto &[name, task, async] : init::getExitTasks())
|
||||
task();
|
||||
init::runExitTasks();
|
||||
|
||||
// Terminate all asynchronous tasks
|
||||
TaskManager::exit();
|
||||
|
||||
@@ -608,6 +608,14 @@ namespace hex::init {
|
||||
return true;
|
||||
}
|
||||
|
||||
// run all exit taks, and print to console
|
||||
void runExitTasks() {
|
||||
for (const auto &[name, task, async] : init::getExitTasks()) {
|
||||
task();
|
||||
log::info("Finished exit task {}", name);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<Task> getInitTasks() {
|
||||
return {
|
||||
{ "Setting up environment", setupEnvironment, false },
|
||||
|
||||
@@ -95,8 +95,7 @@ namespace {
|
||||
*/
|
||||
void deinitializeImHex() {
|
||||
// Run exit tasks
|
||||
for (const auto &[name, task, async] : init::getExitTasks())
|
||||
task();
|
||||
init::runExitTasks();
|
||||
|
||||
// Terminate all asynchronous tasks
|
||||
TaskManager::exit();
|
||||
|
||||
Reference in New Issue
Block a user