mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-30 16:39:21 +01:00
Clean up direct X installation slightly
This commit is contained in:
@@ -121,16 +121,26 @@ namespace Tgstation.Server.Host.Components.Byond
|
||||
//after this version lummox made DD depend of directx lol
|
||||
if (version.Major >= 512 && version.Minor >= 1427 && !installedDirectX)
|
||||
using (await SemaphoreSlimContext.Lock(semaphore, cancellationToken).ConfigureAwait(false))
|
||||
//check again because race conditions
|
||||
if (!installedDirectX)
|
||||
{
|
||||
//always install it, it's pretty fast and will do better redundancy checking than us
|
||||
var rbdx = ioManager.ConcatPath(path, ByondDXDir);
|
||||
//noShellExecute because we aren't doing runas shennanigans
|
||||
using (var p = processExecutor.LaunchProcess(ioManager.ConcatPath(rbdx, "DXSETUP.exe"), rbdx, "/silent", noShellExecute: true))
|
||||
IProcess directXInstaller;
|
||||
try
|
||||
{
|
||||
directXInstaller = processExecutor.LaunchProcess(ioManager.ConcatPath(rbdx, "DXSETUP.exe"), rbdx, "/silent", noShellExecute: true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new JobException("Unable to start DirectX installer process! Is the server running with admin privileges?", e);
|
||||
}
|
||||
using (directXInstaller)
|
||||
{
|
||||
int exitCode;
|
||||
using (cancellationToken.Register(() => p.Terminate()))
|
||||
exitCode = await p.Lifetime.ConfigureAwait(false);
|
||||
using (cancellationToken.Register(() => directXInstaller.Terminate()))
|
||||
exitCode = await directXInstaller.Lifetime.ConfigureAwait(false);
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
if (exitCode != 0)
|
||||
|
||||
Reference in New Issue
Block a user