mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-24 22:35:49 -04:00
Fixed: Backend Updates from Sonarr
Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com> Co-Authored-By: taloth <taloth@users.noreply.github.com>
This commit is contained in:
@@ -27,7 +27,7 @@ namespace NzbDrone.Common.Processes
|
||||
bool Exists(string processName);
|
||||
ProcessPriorityClass GetCurrentProcessPriority();
|
||||
Process Start(string path, string args = null, StringDictionary environmentVariables = null, Action<string> onOutputDataReceived = null, Action<string> onErrorDataReceived = null);
|
||||
Process SpawnNewProcess(string path, string args = null, StringDictionary environmentVariables = null);
|
||||
Process SpawnNewProcess(string path, string args = null, StringDictionary environmentVariables = null, bool noWindow = false);
|
||||
ProcessOutput StartAndCapture(string path, string args = null, StringDictionary environmentVariables = null);
|
||||
}
|
||||
|
||||
@@ -108,11 +108,7 @@ namespace NzbDrone.Common.Processes
|
||||
|
||||
public Process Start(string path, string args = null, StringDictionary environmentVariables = null, Action<string> onOutputDataReceived = null, Action<string> onErrorDataReceived = null)
|
||||
{
|
||||
if (PlatformInfo.IsMono && path.EndsWith(".exe", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
args = GetMonoArgs(path, args);
|
||||
path = "mono";
|
||||
}
|
||||
(path, args) = GetPathAndArgs(path, args);
|
||||
|
||||
var logger = LogManager.GetLogger(new FileInfo(path).Name);
|
||||
|
||||
@@ -190,17 +186,16 @@ namespace NzbDrone.Common.Processes
|
||||
return process;
|
||||
}
|
||||
|
||||
public Process SpawnNewProcess(string path, string args = null, StringDictionary environmentVariables = null)
|
||||
public Process SpawnNewProcess(string path, string args = null, StringDictionary environmentVariables = null, bool noWindow = false)
|
||||
{
|
||||
if (PlatformInfo.IsMono && path.EndsWith(".exe", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
args = GetMonoArgs(path, args);
|
||||
path = "mono";
|
||||
}
|
||||
(path, args) = GetPathAndArgs(path, args);
|
||||
|
||||
_logger.Debug("Starting {0} {1}", path, args);
|
||||
|
||||
var startInfo = new ProcessStartInfo(path, args);
|
||||
startInfo.CreateNoWindow = noWindow;
|
||||
startInfo.UseShellExecute = !noWindow;
|
||||
|
||||
var process = new Process
|
||||
{
|
||||
StartInfo = startInfo
|
||||
@@ -333,7 +328,6 @@ namespace NzbDrone.Common.Processes
|
||||
|
||||
var monoProcesses = Process.GetProcessesByName("mono")
|
||||
.Union(Process.GetProcessesByName("mono-sgen"))
|
||||
.Union(Process.GetProcessesByName("mono-sgen32"))
|
||||
.Where(process =>
|
||||
process.Modules.Cast<ProcessModule>()
|
||||
.Any(module =>
|
||||
@@ -359,9 +353,19 @@ namespace NzbDrone.Common.Processes
|
||||
return processes;
|
||||
}
|
||||
|
||||
private string GetMonoArgs(string path, string args)
|
||||
private (string Path, string Args) GetPathAndArgs(string path, string args)
|
||||
{
|
||||
return string.Format("--debug {0} {1}", path, args);
|
||||
if (PlatformInfo.IsMono && path.EndsWith(".exe", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return ("mono", $"--debug {path} {args}");
|
||||
}
|
||||
|
||||
if (OsInfo.IsWindows && path.EndsWith(".bat", StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
return ("cmd.exe", $"/c {path} {args}");
|
||||
}
|
||||
|
||||
return (path, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user