Fix process died Log-Spam

experimental/UWP_Inject
Peter Repukat 3 years ago
parent 86d9a172db
commit f5b71bf9c9

@ -49,7 +49,7 @@ void AppLauncher::launchApp(const std::wstring& path, const std::wstring& args)
void AppLauncher::update() void AppLauncher::update()
{ {
if (process_check_clock_.getElapsedTime().asSeconds() > 1) { if (process_check_clock_.getElapsedTime().asSeconds() > 1 && !logged_process_died_) {
#ifdef _WIN32 #ifdef _WIN32
if (process_info.dwProcessId > 0) { if (process_info.dwProcessId > 0) {
if (!IsProcessRunning(process_info.dwProcessId)) { if (!IsProcessRunning(process_info.dwProcessId)) {
@ -58,6 +58,7 @@ void AppLauncher::update()
spdlog::info("Configured to close on exit. Shutting down.."); spdlog::info("Configured to close on exit. Shutting down..");
shutdown_(); shutdown_();
} }
logged_process_died_ = true;
} }
} }
if (uwp_pid_ > 0) { if (uwp_pid_ > 0) {
@ -67,6 +68,7 @@ void AppLauncher::update()
spdlog::info("Configured to close on exit. Shutting down..."); spdlog::info("Configured to close on exit. Shutting down...");
shutdown_(); shutdown_();
} }
logged_process_died_ = true;
} }
} }
#endif #endif

@ -34,8 +34,8 @@ class AppLauncher {
private: private:
std::function<void()> shutdown_; std::function<void()> shutdown_;
sf::Clock process_check_clock_; sf::Clock process_check_clock_;
bool logged_process_died_ = false;
#ifdef _WIN32 #ifdef _WIN32
static bool IsProcessRunning(DWORD pid); static bool IsProcessRunning(DWORD pid);

Loading…
Cancel
Save