mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
Sync OsInfo with upstream (#5163)
This commit is contained in:
parent
c6c52c4117
commit
c750f4764f
1 changed files with 24 additions and 12 deletions
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
@ -109,18 +109,31 @@ namespace NzbDrone.Common.EnvironmentInfo
|
||||||
|
|
||||||
private static string RunAndCapture(string filename, string args)
|
private static string RunAndCapture(string filename, string args)
|
||||||
{
|
{
|
||||||
var p = new Process();
|
var processStartInfo = new ProcessStartInfo
|
||||||
p.StartInfo.FileName = filename;
|
{
|
||||||
p.StartInfo.Arguments = args;
|
FileName = filename,
|
||||||
p.StartInfo.UseShellExecute = false;
|
Arguments = args,
|
||||||
p.StartInfo.CreateNoWindow = true;
|
UseShellExecute = false,
|
||||||
p.StartInfo.RedirectStandardOutput = true;
|
CreateNoWindow = true,
|
||||||
|
RedirectStandardOutput = true
|
||||||
|
};
|
||||||
|
|
||||||
p.Start();
|
var output = string.Empty;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var p = Process.Start(processStartInfo))
|
||||||
|
{
|
||||||
// To avoid deadlocks, always read the output stream first and then wait.
|
// To avoid deadlocks, always read the output stream first and then wait.
|
||||||
var output = p.StandardOutput.ReadToEnd();
|
output = p.StandardOutput.ReadToEnd();
|
||||||
|
|
||||||
p.WaitForExit(1000);
|
p.WaitForExit(1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
output = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +144,6 @@ namespace NzbDrone.Common.EnvironmentInfo
|
||||||
string Version { get; }
|
string Version { get; }
|
||||||
string Name { get; }
|
string Name { get; }
|
||||||
string FullName { get; }
|
string FullName { get; }
|
||||||
|
|
||||||
bool IsDocker { get; }
|
bool IsDocker { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue