mirror of
https://github.com/cupcakearmy/autorestic.git
synced 2025-01-22 06:46:24 +00:00
exit with better message
This commit is contained in:
parent
e927fd5a64
commit
86d44eafad
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user