From d7833a5977ca3cdcf6dda586308946877bc30c0f 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 07da47a05..af9bca0a8 100644 --- a/lib/cli/daemoncommand.cpp +++ b/lib/cli/daemoncommand.cpp @@ -688,7 +688,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 af9bca0a8..e25048c1b 100644 --- a/lib/cli/daemoncommand.cpp +++ b/lib/cli/daemoncommand.cpp @@ -526,6 +526,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); } @@ -690,6 +693,9 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector