refactor
All checks were successful
Blockstorage/repertory/pipeline/head This commit looks good
BlockStorage/repertory/pipeline/head This commit looks good

This commit is contained in:
2025-09-15 12:58:46 -05:00
parent f2f28cea59
commit 6b2bf3ab67

View File

@@ -49,10 +49,12 @@ namespace repertory::ui {
return static_cast<std::int32_t>(exit_code::ui_failed);
}
const auto run_ui = [](auto *server) {
const auto run_ui = [&]() -> int {
REPERTORY_USES_FUNCTION_NAME();
static std::atomic<ui_server *> active_server{server};
ui_server server(&config);
static std::atomic<ui_server *> active_server{&server};
static const auto quit_handler = [](int /* sig */) {
REPERTORY_USES_FUNCTION_NAME();
@@ -66,6 +68,8 @@ namespace repertory::ui {
} catch (const std::exception &ex) {
utils::error::raise_error(function_name, ex, "failed to stop ui");
}
repertory::project_cleanup();
};
std::signal(SIGINT, quit_handler);
@@ -75,24 +79,17 @@ namespace repertory::ui {
std::signal(SIGTERM, quit_handler);
try {
server->start();
server.start();
} catch (const std::exception &ex) {
utils::error::raise_error(function_name, ex, "failed to start ui");
}
try {
server->stop();
} catch (const std::exception &ex) {
utils::error::raise_error(function_name, ex, "failed to stop ui");
}
repertory::project_cleanup();
quit_handler(SIGTERM);
return 0;
};
#if defined(_WIN32)
ui_server server(&config);
run_ui(&server);
return 0;
return run_ui();
#else // !defined(_WIN32)
repertory::project_cleanup();
@@ -106,9 +103,7 @@ namespace repertory::ui {
return -1;
}
ui_server server(&config);
run_ui(&server);
return 0;
return run_ui();
});
#endif // defined(_WIN32)
}