Close the DB before deleting ooni_home
This commit is contained in:
parent
5567fe1d2b
commit
2b01dfaa17
|
@ -15,7 +15,14 @@ func init() {
|
||||||
cmd.Action(func(_ *kingpin.ParseContext) error {
|
cmd.Action(func(_ *kingpin.ParseContext) error {
|
||||||
ctx, err := root.Init()
|
ctx, err := root.Init()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("%s", err)
|
log.WithError(err).Error("failed to init root context")
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// We need to first the DB otherwise the DB will be rewritten on close when
|
||||||
|
// we delete the home directory.
|
||||||
|
err = ctx.DB.Close()
|
||||||
|
if err != nil {
|
||||||
|
log.WithError(err).Error("failed to close the DB")
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if *force == true {
|
if *force == true {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user