mirror of https://github.com/lidarr/Lidarr
Fixed: Restart button restarts Lidarr correctly
This commit is contained in:
parent
4f8ed1bad5
commit
11e0d36592
|
@ -27,14 +27,22 @@ namespace NzbDrone.Common.EnvironmentInfo
|
||||||
serviceProvider.ServiceExist(ServiceProvider.SERVICE_NAME) &&
|
serviceProvider.ServiceExist(ServiceProvider.SERVICE_NAME) &&
|
||||||
serviceProvider.GetStatus(ServiceProvider.SERVICE_NAME) == ServiceControllerStatus.StartPending;
|
serviceProvider.GetStatus(ServiceProvider.SERVICE_NAME) == ServiceControllerStatus.StartPending;
|
||||||
|
|
||||||
//Guarded to avoid issues when running in a non-managed process
|
#if NETCOREAPP
|
||||||
var entry = Assembly.GetEntryAssembly();
|
// net5.0 will return Lidarr.dll for entry assembly, we need the actual
|
||||||
|
// executable name (Lidarr on linux). On mono this will return the location of
|
||||||
|
// the mono executable itself, which is not what we want.
|
||||||
|
var entry = Process.GetCurrentProcess().MainModule;
|
||||||
|
|
||||||
if (entry != null)
|
if (entry != null)
|
||||||
{
|
{
|
||||||
ExecutingApplication = entry.Location;
|
ExecutingApplication = entry.FileName;
|
||||||
IsWindowsTray = OsInfo.IsWindows && entry.ManifestModule.Name == $"{ProcessProvider.LIDARR_PROCESS_NAME}.exe";
|
IsWindowsTray = OsInfo.IsWindows && entry.ModuleName == $"{ProcessProvider.LIDARR_PROCESS_NAME}.exe";
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
// On mono we need to get the location of the Lidarr assembly, not Mono.
|
||||||
|
// Can't be running tray app in mono.
|
||||||
|
ExecutingApplication = Assembly.GetEntryAssembly()?.Location;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static RuntimeInfo()
|
static RuntimeInfo()
|
||||||
|
|
Loading…
Reference in New Issue