diff --git a/cmd/context.go b/cmd/context.go index 50f65502..ff5f2923 100644 --- a/cmd/context.go +++ b/cmd/context.go @@ -139,7 +139,13 @@ func ShutdownContext() { context.fileMemProfile = nil } } - context.database.Close() - context.downloader.Shutdown() - context.progress.Shutdown() + if context.database != nil { + context.database.Close() + } + if context.downloader != nil { + context.downloader.Shutdown() + } + if context.progress != nil { + context.progress.Shutdown() + } } diff --git a/main.go b/main.go index 20f34856..7615b3cf 100644 --- a/main.go +++ b/main.go @@ -39,6 +39,7 @@ func loadConfig(command *commander.Command) error { } if !os.IsNotExist(err) { fatal(fmt.Errorf("error loading config file %s: %s", configLocation, err)) + return nil } } @@ -67,6 +68,9 @@ func main() { fatal(err) return } + if returnCode != 0 { + return + } err = cmd.InitContext(command) if err != nil {