Skip to content

Commit

Permalink
APP-7128 close-before-move fix for windows (#4683)
Browse files Browse the repository at this point in the history
  • Loading branch information
abe-winter authored Jan 7, 2025
1 parent 4df774c commit 3023786
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions data/capture_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ func (f *CaptureFile) Close() error {
// Rename file to indicate that it is done being written.
withoutExt := strings.TrimSuffix(f.file.Name(), filepath.Ext(f.file.Name()))
newName := withoutExt + CompletedCaptureFileExt
if err := os.Rename(f.file.Name(), newName); err != nil {
if err := f.file.Close(); err != nil {
return err
}
return f.file.Close()
return os.Rename(f.file.Name(), newName)
}

// Delete deletes the file.
Expand Down

0 comments on commit 3023786

Please sign in to comment.