From 582b996d4707938318d51b534a4728c44f9cc92a Mon Sep 17 00:00:00 2001 From: Cyberboss Date: Tue, 4 Jul 2017 14:35:21 -0400 Subject: [PATCH] Fixes the gotcha with Process.Kill() --- TGServerService/Compiler.cs | 3 +++ TGServerService/DreamDaemon.cs | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/TGServerService/Compiler.cs b/TGServerService/Compiler.cs index 63fbe5b8d8..307cc166a2 100644 --- a/TGServerService/Compiler.cs +++ b/TGServerService/Compiler.cs @@ -415,7 +415,10 @@ namespace TGServerService catch { if (!DM.HasExited) + { DM.Kill(); + DM.WaitForExit(); + } throw; } finally diff --git a/TGServerService/DreamDaemon.cs b/TGServerService/DreamDaemon.cs index 28db4dd5ce..fd8970ff26 100644 --- a/TGServerService/DreamDaemon.cs +++ b/TGServerService/DreamDaemon.cs @@ -266,7 +266,10 @@ namespace TGServerService try { if (!Properties.Settings.Default.ReattachToDD) + { Proc.Kill(); + Proc.WaitForExit(); + } else { Properties.Settings.Default.ReattachPID = Proc.Id; @@ -402,6 +405,7 @@ namespace TGServerService if (!Proc.WaitForInputIdle(DDHangStartTime * 1000)) { Proc.Kill(); + Proc.WaitForExit(); Proc.Close(); ShutdownInterop(); currentStatus = TGDreamDaemonStatus.Offline;