fix(watch): capture Windows file identity before external moves

This commit is contained in:
eezd committed 2026-10-27 15:03:57 +08:00
1 parent 1a8f70ca13
commit 18bbb60a3b
4 files changed
+41 -4

No files matched your search

+16
View File
@@ -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())
}