forked from mirror/readline
fix history rewrite fd close
This commit is contained in:
parent
9f55547f9b
commit
aec0cc08d9
|
@ -80,7 +80,6 @@ func (o *opHistory) HistoryRewrite() {
|
|||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer fd.Close()
|
||||
|
||||
buf := bufio.NewWriter(fd)
|
||||
for elem := o.history.Front(); elem != nil; elem = elem.Next() {
|
||||
|
@ -90,6 +89,7 @@ func (o *opHistory) HistoryRewrite() {
|
|||
|
||||
// replace history file
|
||||
if err = os.Rename(tmpFile, o.cfg.HistoryFile); err != nil {
|
||||
fd.Close()
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue