From b1536eac6ffe679663738e632c4125a950699829 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 d6f5c610a..3fcd55679 100644 --- a/lib/cli/daemoncommand.cpp +++ b/lib/cli/daemoncommand.cpp @@ -641,7 +641,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 3fcd55679..dc6cab2bd 100644 --- a/lib/cli/daemoncommand.cpp +++ b/lib/cli/daemoncommand.cpp @@ -479,6 +479,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); } @@ -643,6 +646,9 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector