fix(win32): add 50ms tolerance for NTFS mtime fuzziness in FileTime assert (#14907)
This commit is contained in:
parent
3d379c20c4
commit
36197f5ff8
1 changed files with 2 additions and 1 deletions
|
|
@ -61,7 +61,8 @@ export namespace FileTime {
|
||||||
const time = get(sessionID, filepath)
|
const time = get(sessionID, filepath)
|
||||||
if (!time) throw new Error(`You must read file ${filepath} before overwriting it. Use the Read tool first`)
|
if (!time) throw new Error(`You must read file ${filepath} before overwriting it. Use the Read tool first`)
|
||||||
const mtime = Filesystem.stat(filepath)?.mtime
|
const mtime = Filesystem.stat(filepath)?.mtime
|
||||||
if (mtime && mtime.getTime() > time.getTime()) {
|
// Allow a 50ms tolerance for Windows NTFS timestamp fuzziness / async flushing
|
||||||
|
if (mtime && mtime.getTime() > time.getTime() + 50) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`File ${filepath} has been modified since it was last read.\nLast modification: ${mtime.toISOString()}\nLast read: ${time.toISOString()}\n\nPlease read the file again before modifying it.`,
|
`File ${filepath} has been modified since it was last read.\nLast modification: ${mtime.toISOString()}\nLast read: ${time.toISOString()}\n\nPlease read the file again before modifying it.`,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue