Merge pull request #650 from cgutman/term_logging_feedback

Remove Enter prompt on exit and make log levels for execution messages consistent
This commit is contained in:
ReenigneArcher 2022-12-29 15:27:32 -05:00 committed by GitHub
commit 8b3b00059e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 26 deletions

View File

@ -158,8 +158,6 @@ LRESULT CALLBACK SessionMonitorWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, L
int main(int argc, char *argv[]) {
util::TaskPool::task_id_t force_shutdown = nullptr;
bool shutdown_by_interrupt = false;
#ifdef _WIN32
// Wait as long as possible to terminate Sunshine.exe during logoff/shutdown
SetProcessShutdownParameters(0x100, SHUTDOWN_NORETRY);
@ -204,26 +202,6 @@ int main(int argc, char *argv[]) {
window_thread.detach();
#endif
auto exit_guard = util::fail_guard([&shutdown_by_interrupt, &force_shutdown]() {
if(!shutdown_by_interrupt) {
return;
}
#ifdef _WIN32
// If this is running from a service with no console window, don't wait for user input to exit
if(GetConsoleWindow() == NULL) {
return;
}
#endif
task_pool.cancel(force_shutdown);
std::cout << "Sunshine exited: Press enter to continue"sv << std::endl;
std::string _;
std::getline(std::cin, _);
});
mail::man = std::make_shared<safe::mail_raw_t>();
if(config::parse(argc, argv)) {
@ -304,7 +282,7 @@ int main(int argc, char *argv[]) {
// Create signal handler after logging has been initialized
auto shutdown_event = mail::man->event<bool>(mail::shutdown);
on_signal(SIGINT, [&shutdown_by_interrupt, &force_shutdown, shutdown_event]() {
on_signal(SIGINT, [&force_shutdown, shutdown_event]() {
BOOST_LOG(info) << "Interrupt handler called"sv;
auto task = []() {
@ -314,7 +292,6 @@ int main(int argc, char *argv[]) {
};
force_shutdown = task_pool.pushDelayed(task, 10s).task_id;
shutdown_by_interrupt = true;
shutdown_event->raise(true);
});

View File

@ -150,7 +150,7 @@ int proc_t::execute(int app_id) {
}
if(proc.cmd.empty()) {
BOOST_LOG(debug) << "Executing [Desktop]"sv;
BOOST_LOG(info) << "Executing [Desktop]"sv;
placebo = true;
}
else {
@ -202,7 +202,7 @@ void proc_t::terminate() {
continue;
}
BOOST_LOG(debug) << "Executing: ["sv << cmd << ']';
BOOST_LOG(info) << "Executing: ["sv << cmd << ']';
auto ret = exe_with_full_privs(cmd, _env, _pipe, ec);