From 0625c1e7da465cddfdf7818ab87b142348b58e03 Mon Sep 17 00:00:00 2001 From: Caelan Sayler Date: Thu, 28 Mar 2024 13:02:31 +0000 Subject: [PATCH] Don't bother with foreground window on unix --- src/Velopack/UpdateExe.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Velopack/UpdateExe.cs b/src/Velopack/UpdateExe.cs index 7531b2dc..d283416c 100644 --- a/src/Velopack/UpdateExe.cs +++ b/src/Velopack/UpdateExe.cs @@ -74,12 +74,14 @@ namespace Velopack var p = Process.Start(psi); - if (p is not null) { - try { - // this is an attempt to work around a bug where the restarted app fails to come to foreground. - AllowSetForegroundWindow(p.Id); - } catch (Exception ex) { - logger.LogWarning(ex, "Failed to allow Update.exe to set foreground window."); + if (VelopackRuntimeInfo.IsWindows) { + if (p is not null) { + try { + // this is an attempt to work around a bug where the restarted app fails to come to foreground. + AllowSetForegroundWindow(p.Id); + } catch (Exception ex) { + logger.LogWarning(ex, "Failed to allow Update.exe to set foreground window."); + } } }