From 4216f07ec71e7bd1c1c485fe16faa588e7e074c5 Mon Sep 17 00:00:00 2001 From: "M. Mert Yildiran" Date: Mon, 13 Mar 2023 22:51:48 +0300 Subject: [PATCH] :bug: `os.Exit` after returning from the HTTP handler --- cmd/pro.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/pro.go b/cmd/pro.go index 711ae864e..c7dc5a3d7 100644 --- a/cmd/pro.go +++ b/cmd/pro.go @@ -5,6 +5,7 @@ import ( "io/ioutil" "net/http" "os" + "time" "github.com/creasty/defaults" "github.com/gin-gonic/gin" @@ -71,11 +72,14 @@ func updateLicense(licenseKey string) { panic(err) } - connector.PostLicense(config.Config.License) + go func() { + connector.PostLicense(config.Config.License) - log.Info().Msg("Updated the license. Exiting.") + log.Info().Msg("Updated the license. Exiting.") - os.Exit(0) + time.Sleep(2 * time.Second) + os.Exit(0) + }() } func runLicenseRecieverServer() {