mirror of https://github.com/chzyer/readline.git
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 {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer fd.Close()
|
|
||||||
|
|
||||||
buf := bufio.NewWriter(fd)
|
buf := bufio.NewWriter(fd)
|
||||||
for elem := o.history.Front(); elem != nil; elem = elem.Next() {
|
for elem := o.history.Front(); elem != nil; elem = elem.Next() {
|
||||||
|
@ -90,6 +89,7 @@ func (o *opHistory) HistoryRewrite() {
|
||||||
|
|
||||||
// replace history file
|
// replace history file
|
||||||
if err = os.Rename(tmpFile, o.cfg.HistoryFile); err != nil {
|
if err = os.Rename(tmpFile, o.cfg.HistoryFile); err != nil {
|
||||||
|
fd.Close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue