diff --git a/ErsatzTV-Windows/ErsatzTV-Windows.csproj b/ErsatzTV-Windows/ErsatzTV-Windows.csproj
index db3d6b6f6..598e68eaa 100644
--- a/ErsatzTV-Windows/ErsatzTV-Windows.csproj
+++ b/ErsatzTV-Windows/ErsatzTV-Windows.csproj
@@ -17,7 +17,7 @@
-
+
diff --git a/ErsatzTV-Windows/TrayApplicationContext.cs b/ErsatzTV-Windows/TrayApplicationContext.cs
index 18a4e3fa6..8ae26f295 100644
--- a/ErsatzTV-Windows/TrayApplicationContext.cs
+++ b/ErsatzTV-Windows/TrayApplicationContext.cs
@@ -1,14 +1,13 @@
using ErsatzTV.Core;
using System.Diagnostics;
-using Asmichi.ProcessManagement;
-using System.Reflection;
+using CliWrap;
namespace ErsatzTV_Windows;
public class TrayApplicationContext : ApplicationContext
{
private readonly NotifyIcon _trayIcon;
- private readonly IChildProcess? _childProcess;
+ private readonly CancellationTokenSource _tokenSource;
public TrayApplicationContext()
{
@@ -19,6 +18,8 @@ public class TrayApplicationContext : ApplicationContext
Visible = true
};
+ _tokenSource = new CancellationTokenSource();
+
AddMenuItem("Launch Web UI", LaunchWebUI);
AddMenuItem("Show Logs", ShowLogs);
_trayIcon.ContextMenuStrip.Items.Add(new ToolStripSeparator());
@@ -29,8 +30,11 @@ public class TrayApplicationContext : ApplicationContext
if (File.Exists(exe))
{
- var si = new ChildProcessStartInfo(exe);
- _childProcess = ChildProcess.Start(si);
+
+ Cli.Wrap(exe)
+ .WithWorkingDirectory(folder)
+ .WithValidation(CommandResultValidation.None)
+ .ExecuteAsync(_tokenSource.Token);
}
}
@@ -64,7 +68,7 @@ public class TrayApplicationContext : ApplicationContext
protected override void Dispose(bool disposing)
{
- _childProcess?.Dispose();
+ _tokenSource?.Cancel();
base.Dispose(disposing);
}