fix(watch): capture Windows file identity before external moves
This commit is contained in:
1 parent
1a8f70ca13
commit
18bbb60a3b
4 files changed
+41
-4
No files matched your search
@@ -0,0 +1,16 @@
|
||||
package watch
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
)
|
||||
|
||||
func snapshotInfo(path string) (os.FileInfo, error) {
|
||||
file, err := os.Open(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// File.Stat captures the file ID from its open handle, before external renames.
|
||||
info, err := file.Stat()
|
||||
return info, errors.Join(err, file.Close())
|
||||
}
|
||||
Reference in new issue
Block a user