From ee70a539e000d2d2ae637f4fa5b9589600d1f833 Mon Sep 17 00:00:00 2001 From: Ivan Date: Mon, 18 Jan 2021 00:28:47 +0200 Subject: [PATCH] Run os.Exit on error (#27) --- main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.go b/main.go index d3cb817..7e7013e 100644 --- a/main.go +++ b/main.go @@ -79,12 +79,14 @@ func main() { config, err := GetConfig(configPath) if err != nil { fmt.Fprintf(os.Stderr, err.Error()) + os.Exit(1) } err = smug.Start(config, options, context) if err != nil { fmt.Println("Oops, an error occurred! Rolling back...") smug.Stop(config, options, context) + os.Exit(1) } case CommandStop: if len(options.Windows) == 0 { @@ -95,17 +97,20 @@ func main() { config, err := GetConfig(configPath) if err != nil { fmt.Fprintf(os.Stderr, err.Error()) + os.Exit(1) } err = smug.Stop(config, options, context) if err != nil { fmt.Fprintf(os.Stderr, err.Error()) + os.Exit(1) } case CommandNew: case CommandEdit: err := EditConfig(configPath) if err != nil { fmt.Fprintf(os.Stderr, err.Error()) + os.Exit(1) } }