From 4611ddab2a3050839f88059036b8b4360c33be5c Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Fri, 26 Oct 2018 09:16:49 +0200 Subject: [PATCH] Added code to re-spawn `Duplicati.WindowsService.exe` if the child signals an update --- Duplicati/Service/Runner.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Duplicati/Service/Runner.cs b/Duplicati/Service/Runner.cs index 4f2ae0f76..a9140b837 100644 --- a/Duplicati/Service/Runner.cs +++ b/Duplicati/Service/Runner.cs @@ -109,6 +109,22 @@ namespace Duplicati.Service PingProcess(); } } + + // Check if the child process is signalling an update + if (m_process.ExitCode == Duplicati.Library.AutoUpdater.UpdaterManager.MAGIC_EXIT_CODE) + { + // If we are a spawned update process, our parent process will restart us + if (Duplicati.Library.AutoUpdater.UpdaterManager.IsRunningInUpdateEnvironment) + { + // Hard exit from here + Environment.Exit(Duplicati.Library.AutoUpdater.UpdaterManager.MAGIC_EXIT_CODE); + } + else + { + // Log this to help in debugging + m_reportMessage("Child process stopped with an update code, but we are not running in an update environment. Ignoring update request", true); + } + } } catch (Exception ex) {