From b3d67ecd1930dabc70946190b89222f53c3a125f Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 11 Oct 2021 13:34:25 +0200 Subject: [PATCH] Only trigger shutdown/restart events when not in dev mode --- core/core.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/core.go b/core/core.go index bcdc450b..1e08e0f5 100644 --- a/core/core.go +++ b/core/core.go @@ -4,6 +4,8 @@ import ( "fmt" "time" + "github.com/safing/portbase/config" + "github.com/safing/portbase/modules" "github.com/safing/portbase/modules/subsystems" "github.com/tevino/abool" @@ -24,6 +26,7 @@ var ( module *modules.Module restarting = abool.New() + devMode = config.Concurrent.GetAsBool(config.CfgDevModeKey, false) ) func init() { @@ -72,6 +75,11 @@ func registerEvents() { } func shutdownHook() { + // Don't trigger event in Dev Mode. + if devMode() { + return + } + // Notify everyone of the restart/shutdown. if restarting.IsNotSet() { module.TriggerEvent(eventShutdown, nil)