mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-04 05:10:40 +00:00
Fix race in shutdown: context should be shut down in case of error.
This commit is contained in:
+9
-3
@@ -139,7 +139,13 @@ func ShutdownContext() {
|
|||||||
context.fileMemProfile = nil
|
context.fileMemProfile = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.database.Close()
|
if context.database != nil {
|
||||||
context.downloader.Shutdown()
|
context.database.Close()
|
||||||
context.progress.Shutdown()
|
}
|
||||||
|
if context.downloader != nil {
|
||||||
|
context.downloader.Shutdown()
|
||||||
|
}
|
||||||
|
if context.progress != nil {
|
||||||
|
context.progress.Shutdown()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ func loadConfig(command *commander.Command) error {
|
|||||||
}
|
}
|
||||||
if !os.IsNotExist(err) {
|
if !os.IsNotExist(err) {
|
||||||
fatal(fmt.Errorf("error loading config file %s: %s", configLocation, err))
|
fatal(fmt.Errorf("error loading config file %s: %s", configLocation, err))
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,6 +68,9 @@ func main() {
|
|||||||
fatal(err)
|
fatal(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if returnCode != 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
err = cmd.InitContext(command)
|
err = cmd.InitContext(command)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user