1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2025-03-10 06:03:09 +00:00

core: fix windows tray crash. resolves #8398 (#9632)

This commit is contained in:
Diego Heras 2020-09-24 23:25:22 +02:00 committed by GitHub
parent b212169dc2
commit 24160106d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -94,21 +94,21 @@ namespace Jackett.Tray
if (windowsService.ServiceExists() && windowsService.ServiceRunning()) if (windowsService.ServiceExists() && windowsService.ServiceRunning())
{ {
//We won't be able to start the tray app up again from the updater, as when running via a windows service there is no interaction with the desktop // We won't be able to start the tray app up again from the updater, as when running via a windows service
//Fire off a console process that will start the tray 20 seconds later // there is no interaction with the desktop.
// Fire off a console process that will start the tray 30 seconds later
var trayExePath = Assembly.GetEntryAssembly().Location; var trayExePath = Process.GetCurrentProcess().MainModule.FileName;
var startInfo = new ProcessStartInfo() var startInfo = new ProcessStartInfo()
{ {
Arguments = $"/c timeout 20 > NUL & \"{trayExePath}\" --UpdatedVersion yes", Arguments = $"/c timeout 30 > NUL & \"{trayExePath}\" --UpdatedVersion yes",
FileName = "cmd.exe", FileName = "cmd.exe",
UseShellExecute = true, UseShellExecute = true,
CreateNoWindow = true, CreateNoWindow = true,
WindowStyle = ProcessWindowStyle.Hidden WindowStyle = ProcessWindowStyle.Hidden
}; };
logger.Info("Starting 20 second delay tray launch as Jackett is running as a Windows service: " + startInfo.FileName + " " + startInfo.Arguments); logger.Info($"Starting 30 second delay tray launch as Jackett is running as a Windows service: {startInfo.FileName} {startInfo.Arguments}");
Process.Start(startInfo); Process.Start(startInfo);
} }