diff --git a/README.md b/README.md
index b60089cbe..44dd4fac7 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,7 @@ Developer note: The software implements the [Torznab](https://github.com/Sonarr/
#### Supported Systems
* Windows using .NET 4.6.1 or above [Download here](https://www.microsoft.com/net/framework/versions/net461).
-* Linux and macOS using Mono 5.8 or above. [Download here](http://www.mono-project.com/download/). Earlier versions of mono may work, but some trackers may fail to negotiate SSL correctly, and others may cause Jackett to crash when used.
+* Linux and macOS using Mono 5.8 or above. [Download here](http://www.mono-project.com/download/).
### Supported Public Trackers
* 1337x
diff --git a/src/Jackett.Common/Services/UpdateService.cs b/src/Jackett.Common/Services/UpdateService.cs
index a3c808d1d..56f538280 100644
--- a/src/Jackett.Common/Services/UpdateService.cs
+++ b/src/Jackett.Common/Services/UpdateService.cs
@@ -270,15 +270,27 @@ namespace Jackett.Common.Services
private void StartUpdate(string updaterExePath, string installLocation, bool isWindows, bool NoRestart, bool trayWasRunning)
{
+ string appType = "Console";
+ //DI once off Owin
+ IProcessService processService = new ProcessService(logger);
+ IServiceConfigService windowsService = new WindowsServiceConfigService(processService, logger);
+
+ if (isWindows && windowsService.ServiceExists())
+ {
+ appType = "WindowsService";
+ }
+
var exe = Path.GetFileName(ExePath());
var args = string.Join(" ", Environment.GetCommandLineArgs().Skip(1).Select(a => a.Contains(" ") ? "\"" +a + "\"" : a )).Replace("\"", "\\\"");
var startInfo = new ProcessStartInfo();
+ startInfo.UseShellExecute = false;
+ startInfo.CreateNoWindow = true;
// Note: add a leading space to the --Args argument to avoid parsing as arguments
if (isWindows)
{
- startInfo.Arguments = $"--Path \"{installLocation}\" --Type \"{exe}\" --Args \" {args}\"";
+ startInfo.Arguments = $"--Path \"{installLocation}\" --Type \"{appType}\" --Args \" {args}\"";
startInfo.FileName = Path.Combine(updaterExePath);
}
else
@@ -287,13 +299,12 @@ namespace Jackett.Common.Services
args = exe + " " + args;
exe = "mono";
- startInfo.Arguments = $"{Path.Combine(updaterExePath)} --Path \"{installLocation}\" --Type \"{exe}\" --Args \" {args}\"";
+ startInfo.Arguments = $"{Path.Combine(updaterExePath)} --Path \"{installLocation}\" --Type \"{appType}\" --Args \" {args}\"";
startInfo.FileName = "mono";
- startInfo.UseShellExecute = false;
- startInfo.CreateNoWindow = true;
}
- try {
+ try
+ {
var pid = Process.GetCurrentProcess().Id;
startInfo.Arguments += $" --KillPids \"{pid}\"";
}
@@ -317,7 +328,7 @@ namespace Jackett.Common.Services
var procInfo = Process.Start(startInfo);
logger.Info($"Updater started process id: {procInfo.Id}");
if (NoRestart == false)
- {
+ {
logger.Info("Exiting Jackett..");
lockService.Signal();
//TODO: Remove once off Owin
diff --git a/src/Jackett.Service/Service.cs b/src/Jackett.Service/Service.cs
index ba95ec746..7fdd7fd22 100644
--- a/src/Jackett.Service/Service.cs
+++ b/src/Jackett.Service/Service.cs
@@ -77,10 +77,12 @@ namespace Jackett.Service
private void ProcessExited(object sender, EventArgs e)
{
+ logger.Info("Console process exited");
+
if (!serviceStopInitiated)
{
logger.Info("Service stop not responsible for process exit");
- OnStop();
+ Stop();
}
}
@@ -89,7 +91,7 @@ namespace Jackett.Service
if (consoleProcess != null && !consoleProcess.HasExited)
{
consoleProcess.StandardInput.Close();
- System.Threading.Thread.Sleep(1000);
+ consoleProcess.WaitForExit(2000);
if (consoleProcess != null && !consoleProcess.HasExited)
{
consoleProcess.Kill();
diff --git a/src/Jackett.Tray/Jackett.Tray.csproj b/src/Jackett.Tray/Jackett.Tray.csproj
index f48380428..88c8c5d10 100644
--- a/src/Jackett.Tray/Jackett.Tray.csproj
+++ b/src/Jackett.Tray/Jackett.Tray.csproj
@@ -66,6 +66,7 @@
+
Main.cs
@@ -109,6 +110,11 @@
True
+
+
+ 2.2.1
+
+