diff --git a/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs b/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs index c57ae5c352..eb249c99c7 100644 --- a/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs +++ b/src/Tgstation.Server.Host/Components/Byond/WindowsByondInstaller.cs @@ -119,7 +119,10 @@ namespace Tgstation.Server.Host.Components.Byond IProcess directXInstaller; try { - directXInstaller = processExecutor.LaunchProcess(IOManager.ConcatPath(rbdx, "DXSETUP.exe"), rbdx, "/silent", noShellExecute: true); + directXInstaller = processExecutor.LaunchProcess( + IOManager.ConcatPath(rbdx, "DXSETUP.exe"), + rbdx, "/silent", + noShellExecute: true); } catch (Exception e) { diff --git a/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs b/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs index 8cceeb1dd4..7ac55b1dc9 100644 --- a/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs +++ b/src/Tgstation.Server.Host/Components/Deployment/DreamMaker.cs @@ -244,6 +244,7 @@ namespace Tgstation.Server.Host.Components.Deployment ADirectoryName)), $"-clean {job.DmeName}.{DmeExtension}", true, + true, true); int exitCode; using (cancellationToken.Register(() => dm.Terminate())) diff --git a/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs b/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs index aef22ee773..d01de4bbc8 100644 --- a/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs +++ b/src/Tgstation.Server.Host/Components/Session/SessionControllerFactory.cs @@ -213,7 +213,11 @@ namespace Tgstation.Server.Host.Components.Session var noShellExecute = !platformIdentifier.IsWindows; // launch dd - var process = processExecutor.LaunchProcess(byondLock.DreamDaemonPath, basePath, arguments, noShellExecute: noShellExecute); + var process = processExecutor.LaunchProcess( + byondLock.DreamDaemonPath, + basePath, + arguments, + noShellExecute: noShellExecute); try { networkPromptReaper.RegisterProcess(process); diff --git a/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs b/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs index c2ce055042..27a335f896 100644 --- a/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs +++ b/src/Tgstation.Server.Host/Components/StaticFiles/Configuration.cs @@ -456,7 +456,11 @@ namespace Tgstation.Server.Host.Components.StaticFiles var resolvedScriptsDir = ioManager.ResolvePath(EventScriptsSubdirectory); foreach (var I in files.Select(x => ioManager.GetFileName(x)).Where(x => x.StartsWith(scriptName, StringComparison.Ordinal))) - using (var script = processExecutor.LaunchProcess(ioManager.ConcatPath(resolvedScriptsDir, I), resolvedScriptsDir, String.Join(' ', parameters), noShellExecute: true)) + using (var script = processExecutor.LaunchProcess( + ioManager.ConcatPath(resolvedScriptsDir, I), + resolvedScriptsDir, + String.Join(' ', parameters), + noShellExecute: true)) using (cancellationToken.Register(() => script.Terminate())) { var exitCode = await script.Lifetime.ConfigureAwait(false); diff --git a/src/Tgstation.Server.Host/System/ProcessExecutor.cs b/src/Tgstation.Server.Host/System/ProcessExecutor.cs index 79363f0fe7..0c323d3b23 100644 --- a/src/Tgstation.Server.Host/System/ProcessExecutor.cs +++ b/src/Tgstation.Server.Host/System/ProcessExecutor.cs @@ -102,14 +102,23 @@ namespace Tgstation.Server.Host.System } /// - public IProcess LaunchProcess(string fileName, string workingDirectory, string arguments, bool readOutput, bool readError, bool noShellExecute) + public IProcess LaunchProcess( + string fileName, + string workingDirectory, + string arguments, + bool readOutput, + bool readError, + bool noShellExecute) { - if (!noShellExecute && (readOutput || readError)) - { - logger.LogWarning("CODE ERROR: Requesting output/error reading requires noShellExecute to be true! Setting it now..."); + if (fileName == null) + throw new ArgumentNullException(nameof(fileName)); + if (workingDirectory == null) + throw new ArgumentNullException(nameof(workingDirectory)); + if (arguments == null) + throw new ArgumentNullException(nameof(arguments)); - noShellExecute = true; - } + if (!noShellExecute && (readOutput || readError)) + throw new InvalidOperationException("Requesting output/error reading requires noShellExecute to be true!"); logger.LogDebug("{3}aunching process in {0}: {1} {2}", workingDirectory, fileName, arguments, noShellExecute ? "L" : "Shell l"); var handle = new global::System.Diagnostics.Process();