1
0
Fork 0

History writer may be nil

If UserHomeDir() doesn't have a value, this can happen. Fixes
https://github.com/rqlite/rqlite/issues/1486. May also be caused by
failure to open the history file. In any event, this is not something
that should block the CLI from working.
master
Philip O'Toole 9 months ago
parent aad2042be1
commit 73d757313e

@ -231,12 +231,14 @@ func main() {
} }
hw := history.Writer() hw := history.Writer()
if hw != nil {
sz := history.Size() sz := history.Size()
history.Write(term.History, sz, hw) history.Write(term.History, sz, hw)
hw.Close() hw.Close()
if sz <= 0 { if sz <= 0 {
history.Delete() history.Delete()
} }
}
ctx.String("bye~\n") ctx.String("bye~\n")
return nil return nil
}) })

Loading…
Cancel
Save