From 43325055fe4f1febc27740de6cc7021234580f6c Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Fri, 8 Dec 2017 16:33:51 -0500 Subject: [PATCH] Fix BYOND updates not triggering recompile --- TGS.Server/Instance/Byond.cs | 11 +++++++++-- TGS.Server/Instance/Compiler.cs | 31 +++++++++++++++---------------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/TGS.Server/Instance/Byond.cs b/TGS.Server/Instance/Byond.cs index cc44646502..768443aa77 100644 --- a/TGS.Server/Instance/Byond.cs +++ b/TGS.Server/Instance/Byond.cs @@ -306,8 +306,15 @@ namespace TGS.Server RevisionStaging = null; } } - if(staged) - Compile(); + if (staged) + lock (ByondLock) + { + //Some fuckery to trick the compiler into starting even though we're staged + //Won't fuck up the actual compiler thread though + updateStat = ByondStatus.Idle; + Compile(); + updateStat = ByondStatus.Staged; + } } /// public bool UpdateToVersion(int major, int minor) diff --git a/TGS.Server/Instance/Compiler.cs b/TGS.Server/Instance/Compiler.cs index 90ae74a4eb..13108a2692 100644 --- a/TGS.Server/Instance/Compiler.cs +++ b/TGS.Server/Instance/Compiler.cs @@ -289,15 +289,6 @@ namespace TGS.Server { try { - if (GetVersion(ByondVersion.Installed) == null) - { - lock (CompilerLock) - { - lastCompilerError = "BYOND not installed!"; - compilerCurrentStatus = CompilerStatus.Initialized; - return; - } - } if (!RepoConfigsMatch()) { lock (CompilerLock) @@ -419,15 +410,23 @@ namespace TGS.Server return; } + bool stagedBuild; + lock (ByondLock) + { + stagedBuild = updateStat == ByondStatus.Staged; + if (stagedBuild) + updateStat = ByondStatus.CompilingStaged; + else if (GetVersion(ByondVersion.Installed) == null) + lock (CompilerLock) + { + lastCompilerError = "BYOND not installed!"; + compilerCurrentStatus = CompilerStatus.Initialized; + return; + } + } + using (var DM = new Process()) //will kill the process if the thread is terminated { - bool stagedBuild; - lock (ByondLock) - { - stagedBuild = updateStat == ByondStatus.Staged; - if (stagedBuild) - updateStat = ByondStatus.CompilingStaged; - } DM.StartInfo.FileName = RelativePath(Path.Combine(stagedBuild ? StagingDirectoryInner : ByondDirectory, "bin/dm.exe")); DM.StartInfo.Arguments = String.Format("-clean {0}", dmePath); DM.StartInfo.RedirectStandardOutput = true;