IDE: When receiving SIGTERM signal, kill runtime befor bailing out without saving.
Purpose is to allow expedited test termination.
--- a/BeremizIDE.py Thu Dec 22 02:47:20 2022 +0100
+++ b/BeremizIDE.py Sun Jan 01 22:33:29 2023 +0100
@@ -30,6 +30,7 @@
import sys
import shutil
import time
+import signal
from time import time as gettime
from threading import Lock, Timer, currentThread
@@ -508,6 +509,8 @@
self.RefreshAll()
self.LogConsole.SetFocus()
+ signal.signal(signal.SIGTERM,self.signalTERM_handler)
+
def RefreshTitle(self):
name = _("Beremiz")
if self.CTR is not None:
@@ -644,6 +647,11 @@
# prevent event to continue, i.e. cancel closing
event.Veto()
+ def signalTERM_handler(self, sig, frame):
+ print ("Signal TERM caught: kill local runtime and quit, no save")
+ self.KillLocalRuntime()
+ sys.exit()
+
def RefreshFileMenu(self):
self.RefreshRecentProjectsMenu()