Skip to content

Commit

Permalink
server: allow macOS yield RENAME as the uv_fs_event (#7299)
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix authored and vpetrovykh committed May 3, 2024
1 parent f59d85a commit af214fb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion edb/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,15 @@ def watch_dir(file_modified, _event):
handle = new_handle
self._file_watch_handles.append(handle)

def callback(_file_modified, event):
def callback(file_modified, event):
nonlocal handle
if event == 2: # CHANGE
cb()
elif (
event == 1 and # RENAME - macOS issues this event for CHANGE
parent_dir / os.fsdecode(file_modified) == pathlib.Path(path)
):
cb()
elif event == 1 or event == 3: # RENAME, RENAME_CHANGE
# File is likely renamed or deleted, stop watching
finalizer()
Expand Down

0 comments on commit af214fb

Please sign in to comment.