From df18be2a4d5b1bc4364ce78dbdeec52bf73ec01b Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 30 Aug 2020 00:09:05 -0400 Subject: [PATCH] Fixed: Don't fail if ldd doesn't exist --- src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs b/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs index 3658d5ede..92b6b0cbc 100644 --- a/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs +++ b/src/NzbDrone.Common/EnvironmentInfo/OsInfo.cs @@ -109,18 +109,31 @@ namespace NzbDrone.Common.EnvironmentInfo private static string RunAndCapture(string filename, string args) { - Process p = new Process(); - p.StartInfo.FileName = filename; - p.StartInfo.Arguments = args; - p.StartInfo.UseShellExecute = false; - p.StartInfo.CreateNoWindow = true; - p.StartInfo.RedirectStandardOutput = true; + var processStartInfo = new ProcessStartInfo + { + FileName = filename, + Arguments = args, + UseShellExecute = false, + CreateNoWindow = true, + RedirectStandardOutput = true + }; - p.Start(); + var output = string.Empty; - // To avoid deadlocks, always read the output stream first and then wait. - string output = p.StandardOutput.ReadToEnd(); - p.WaitForExit(1000); + try + { + using (var p = Process.Start(processStartInfo)) + { + // To avoid deadlocks, always read the output stream first and then wait. + output = p.StandardOutput.ReadToEnd(); + + p.WaitForExit(1000); + } + } + catch (Exception) + { + output = string.Empty; + } return output; }