Run os.Exit on error (#27)

master
Ivan 3 years ago committed by GitHub
parent e306881d65
commit ee70a539e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)
}
}

Loading…
Cancel
Save