Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -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 = []() {
Expand All @@ -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);
});

Expand Down
4 changes: 2 additions & 2 deletions src/process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);

Expand Down