From 86d44eafadaa735f7df913aea1fe696d7cc8d5c0 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Sat, 17 Apr 2021 20:51:40 +0200 Subject: [PATCH] exit with better message --- internal/lock/lock.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/lock/lock.go b/internal/lock/lock.go index cc2a748..0265142 100644 --- a/internal/lock/lock.go +++ b/internal/lock/lock.go @@ -1,10 +1,11 @@ package lock import ( - "errors" + "os" "path" "sync" + "github.com/cupcakearmy/autorestic/internal/colors" "github.com/spf13/viper" ) @@ -33,7 +34,8 @@ func setLock(locked bool) error { if locked { running := lock.GetBool("running") if running { - panic(errors.New("an instance is already running")) + colors.Error.Println("an instance is already running. exiting") + os.Exit(1) } } lock.Set("running", locked)