mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-19 19:30:44 +00:00
fix export history for windows
This commit is contained in:
parent
ca967ad1bb
commit
a134b1835a
1 changed files with 5 additions and 6 deletions
|
|
@ -497,11 +497,6 @@ func ExportHistory(bc *core.BlockChain, dir string, first, last uint64, newBuild
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
final := filepath.Join(dir, filename(network, idx, id))
|
||||
if err := os.Rename(tmpPath, final); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if _, err := f.Seek(0, io.SeekStart); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -511,7 +506,11 @@ func ExportHistory(bc *core.BlockChain, dir string, first, last uint64, newBuild
|
|||
return err
|
||||
}
|
||||
checksums = append(checksums, common.BytesToHash(h.Sum(buf.Bytes()[:])).Hex())
|
||||
return nil
|
||||
|
||||
// Close before rename. It's required on Windows.
|
||||
f.Close()
|
||||
final := filepath.Join(dir, filename(network, idx, id))
|
||||
return os.Rename(tmpPath, final)
|
||||
}(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue