From 43a9f1d8bcd8e327c50913767bb2caa4f48a70fc Mon Sep 17 00:00:00 2001 From: ZephyrTFA Date: Sun, 18 Aug 2024 04:31:08 -0400 Subject: [PATCH] z --- src/Tgstation.Server.Host/Program.cs | 33 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/Tgstation.Server.Host/Program.cs b/src/Tgstation.Server.Host/Program.cs index 6c9b8c2b74..db37fc3359 100644 --- a/src/Tgstation.Server.Host/Program.cs +++ b/src/Tgstation.Server.Host/Program.cs @@ -6,14 +6,14 @@ using System.Text; using System.Threading; using System.Threading.Tasks; -using InteropServices = System.Runtime.InteropServices; -using Process = System.Diagnostics.Process; - using Tgstation.Server.Host.Common; using Tgstation.Server.Host.Core; using Tgstation.Server.Host.Properties; using Tgstation.Server.Host.System; +using InteropServices = System.Runtime.InteropServices; +using Process = System.Diagnostics.Process; + namespace Tgstation.Server.Host { /// @@ -70,29 +70,30 @@ namespace Tgstation.Server.Host args = listArgs.ToArray(); } - if(InteropServices.RuntimeInformation.IsOSPlatform(InteropServices.OSPlatform.Linux)) + if (InteropServices.RuntimeInformation.IsOSPlatform(InteropServices.OSPlatform.Linux)) { - var proc = new Process + using var proc = new Process { - StartInfo = new ProcessStartInfo - { - FileName = "id", - Arguments = "-u", - UseShellExecute = false, - RedirectStandardOutput = true, - CreateNoWindow = true, - } + StartInfo = new ProcessStartInfo + { + FileName = "id", + Arguments = "-u", + UseShellExecute = false, + RedirectStandardOutput = true, + CreateNoWindow = true, + } }; + proc.Start(); await proc.WaitForExitAsync(); - if(proc.ExitCode is not 0 || !int.TryParse(await proc.StandardOutput.ReadToEndAsync(), out var uid)) { + if (proc.ExitCode is not 0 || !int.TryParse(await proc.StandardOutput.ReadToEndAsync(), out var uid)) { Console.Error.WriteLine("Failed to obtain user id."); return 1; } - if(uid is 0) + + if (uid is 0) { Console.Error.WriteLine("TGS is being run as root. This is not recommended and will prevent launching in a future version!"); - // return 1; } }