From 772bd8e7a5ec2784fc807d17bcdd1a974a2eb840 Mon Sep 17 00:00:00 2001 From: IceStormNG Date: Sat, 13 Jan 2024 11:38:37 +0100 Subject: [PATCH] Fixes for Auto Update (#1908) * Automatically restart audio capture when device changes. * Wait for process to terminate instead of waiting a fixed amount of time. * Application.Exit might not exit if there is a child process running. Environment.Exit(0) do though. --- app/AutoUpdate/AutoUpdateControl.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/AutoUpdate/AutoUpdateControl.cs b/app/AutoUpdate/AutoUpdateControl.cs index 42093c87..32757cfc 100644 --- a/app/AutoUpdate/AutoUpdateControl.cs +++ b/app/AutoUpdate/AutoUpdateControl.cs @@ -120,7 +120,7 @@ namespace GHelper.AutoUpdate Logger.WriteLine(zipName); Logger.WriteLine(exeName); - string command = $"Start-Sleep -Seconds 1; $ErrorActionPreference = \"Stop\"; Expand-Archive \"{zipName}\" -DestinationPath . -Force; Remove-Item \"{zipName}\" -Force; \".\\{exeName}\"; "; + string command = $"$ErrorActionPreference = \"Stop\"; Wait-Process -Name \"GHelper\"; Expand-Archive \"{zipName}\" -DestinationPath . -Force; Remove-Item \"{zipName}\" -Force; \".\\{exeName}\"; "; Logger.WriteLine(command); try @@ -139,7 +139,7 @@ namespace GHelper.AutoUpdate Logger.WriteLine(ex.Message); } - Application.Exit(); + Environment.Exit(0); } }