diff --git a/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs b/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs index 588f2e9fbe..6530a0cc4e 100644 --- a/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs +++ b/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs @@ -125,7 +125,8 @@ namespace Tgstation.Server.Host.Components.Byond { //always install it, it's pretty fast and will do better redundancy checking than us var rbdx = ioManager.ConcatPath(path, ByondDXDir); - using (var p = processExecutor.LaunchProcess(ioManager.ConcatPath(rbdx, "DXSETUP.exe"), rbdx, "/silent")) + //noShellExecute because we aren't doing runas shennanigans + using (var p = processExecutor.LaunchProcess(ioManager.ConcatPath(rbdx, "DXSETUP.exe"), rbdx, "/silent", noShellExecute: true)) { int exitCode; using (cancellationToken.Register(() => p.Terminate())) diff --git a/src/Tgstation.Server.Host/Core/IProcessExecutor.cs b/src/Tgstation.Server.Host/Core/IProcessExecutor.cs index 20c0325a45..acaf145cd4 100644 --- a/src/Tgstation.Server.Host/Core/IProcessExecutor.cs +++ b/src/Tgstation.Server.Host/Core/IProcessExecutor.cs @@ -13,8 +13,9 @@ /// The working directory for the /// If standard output should be read /// If standard error should be read + /// If shell execute should not be used. Ignored if or are set /// A new - IProcess LaunchProcess(string fileName, string workingDirectory, string arguments = null, bool readOutput = false, bool readError = false); + IProcess LaunchProcess(string fileName, string workingDirectory, string arguments = null, bool readOutput = false, bool readError = false, bool noShellExecute = false); /// /// Get a by diff --git a/src/Tgstation.Server.Host/Core/ProcessExecutor.cs b/src/Tgstation.Server.Host/Core/ProcessExecutor.cs index d5eee0b505..9a7c9b85be 100644 --- a/src/Tgstation.Server.Host/Core/ProcessExecutor.cs +++ b/src/Tgstation.Server.Host/Core/ProcessExecutor.cs @@ -53,7 +53,7 @@ namespace Tgstation.Server.Host.Core } /// - public IProcess LaunchProcess(string fileName, string workingDirectory, string arguments, bool readOutput, bool readError) + public IProcess LaunchProcess(string fileName, string workingDirectory, string arguments, bool readOutput, bool readError, bool noShellExecute) { logger.LogDebug("Launching process in {0}: {1} {2}", workingDirectory, fileName, arguments); var handle = new System.Diagnostics.Process(); @@ -62,11 +62,12 @@ namespace Tgstation.Server.Host.Core handle.StartInfo.FileName = fileName; handle.StartInfo.Arguments = arguments; handle.StartInfo.WorkingDirectory = workingDirectory; - + + handle.StartInfo.UseShellExecute = !(noShellExecute || readOutput || readError); + StringBuilder outputStringBuilder = null, errorStringBuilder = null, combinedStringBuilder = null; if (readOutput || readError) { - handle.StartInfo.UseShellExecute = false; combinedStringBuilder = new StringBuilder(); if (readOutput) {