mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-24 21:46:52 +01:00
Fix issues with the GetCommandLine test helper
This commit is contained in:
@@ -66,7 +66,7 @@ namespace Tgstation.Server.Tests.Live
|
||||
if (port.HasValue)
|
||||
result = result.Where(x =>
|
||||
{
|
||||
if (GetCommandLine(x).Contains($"-port {port.Value}"))
|
||||
if (GetCommandLine(x)?.Contains($"-port {port.Value}") ?? false)
|
||||
return true;
|
||||
|
||||
x.Dispose();
|
||||
@@ -85,9 +85,16 @@ namespace Tgstation.Server.Tests.Live
|
||||
return objects.Cast<ManagementBaseObject>().SingleOrDefault()?["CommandLine"]?.ToString();
|
||||
}
|
||||
|
||||
var cmdlineFile = File.ReadAllText($"/proc/{process.Id}/cmdline");
|
||||
var parsed = cmdlineFile.Replace('\0', ' ');
|
||||
return parsed;
|
||||
try
|
||||
{
|
||||
var cmdlineFile = File.ReadAllText($"/proc/{process.Id}/cmdline");
|
||||
var parsed = cmdlineFile.Replace('\0', ' ');
|
||||
return parsed;
|
||||
}
|
||||
catch (FileNotFoundException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static void TerminateAllDDs()
|
||||
|
||||
Reference in New Issue
Block a user