From b98a96258c184f6b2ca1bf437f359465de7fbb24 Mon Sep 17 00:00:00 2001 From: Julian Brost Date: Wed, 27 Jan 2021 15:48:28 +0100 Subject: [PATCH 1/2] Catch exceptions thrown by RunWorker on Windows The same is already done on other platforms in line 529. --- lib/cli/daemoncommand.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cli/daemoncommand.cpp b/lib/cli/daemoncommand.cpp index 37a4055f6..7c23086ef 100644 --- a/lib/cli/daemoncommand.cpp +++ b/lib/cli/daemoncommand.cpp @@ -680,7 +680,11 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector Date: Wed, 27 Jan 2021 15:52:37 +0100 Subject: [PATCH 2/2] Try to log useful information for exceptions thrown by RunWorker --- lib/cli/daemoncommand.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/cli/daemoncommand.cpp b/lib/cli/daemoncommand.cpp index 7c23086ef..1076510d1 100644 --- a/lib/cli/daemoncommand.cpp +++ b/lib/cli/daemoncommand.cpp @@ -518,6 +518,9 @@ static pid_t StartUnixWorker(const std::vector& configs, bool close } _exit(RunWorker(configs, closeConsoleLog, stderrFile)); + } catch (const std::exception& ex) { + Log(LogCritical, "cli") << "Exception in main process: " << DiagnosticInformation(ex); + _exit(EXIT_FAILURE); } catch (...) { _exit(EXIT_FAILURE); } @@ -682,6 +685,9 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector