From af1cee244aa45a5ba82ab9b8a877fb057f6474e2 Mon Sep 17 00:00:00 2001 From: Snider Date: Tue, 24 Mar 2026 21:36:11 +0000 Subject: [PATCH] feat: Core.Run() handles os.Exit on error Co-Authored-By: Virgil --- core.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/core.go b/core.go index efb58b0..70b3378 100644 --- a/core.go +++ b/core.go @@ -7,6 +7,7 @@ package core import ( "context" + "os" "sync" "sync/atomic" ) @@ -66,10 +67,13 @@ func (c *Core) Core() *Core { return c } // // c := core.New(core.WithService(myService.Register)).Value.(*Core) // c.Run() -func (c *Core) Run() Result { +func (c *Core) Run() { r := c.ServiceStartup(c.context, nil) if !r.OK { - return r + if err, ok := r.Value.(error); ok { + Error(err.Error()) + } + os.Exit(1) } if cli := c.Cli(); cli != nil { @@ -77,7 +81,13 @@ func (c *Core) Run() Result { } c.ServiceShutdown(c.context) - return r + + if !r.OK { + if err, ok := r.Value.(error); ok { + Error(err.Error()) + } + os.Exit(1) + } } // --- IPC (uppercase aliases) ---