fix: handle missing histfile correctly
This commit is contained in:
parent
fa9a3657db
commit
59334482bb
1 changed files with 7 additions and 4 deletions
3
main.go
3
main.go
|
@ -53,11 +53,14 @@ func main() {
|
|||
var history []string
|
||||
b, err := ioutil.ReadFile(histfile)
|
||||
if err != nil {
|
||||
if !os.IsNotExist(err) {
|
||||
log.Fatalf("Failure reading history file: %s", err)
|
||||
}
|
||||
} else {
|
||||
if err := json.Unmarshal(b, &history); err != nil {
|
||||
log.Fatalf("Failure parsing history: %s", err)
|
||||
}
|
||||
}
|
||||
|
||||
if *asDemon {
|
||||
persist := !*noPersist
|
||||
|
|
Loading…
Reference in a new issue