Open wdanilo opened 1 year ago
This is probably just an artifact of using copy-on-write on APFS (via fclonefileat
). When the destination does not exist, macOS will do a copy-on-write clone of the file. Presumably that triggers kFSEventStreamEventFlagItemIsFile
on the source of the clone. Unfortunately Apple doesn't really document the file-watching API very much.
I've got a bizarre behavior here. Here is the code:
I'm also running in terminal:
/tmp/out.txt
EXISTS, then running this test DOES NOT causefswatch
to print anything to the console./tmp/out.txt
DOES NOT EXIST, then running the test DOES causefswatch
to print:I discovered that when debugging why my
cargo-watch
loops forever on building our sources. It seems that when we are copying files, the source file triggers an event, which triggerscargo-watch
...Please note, that this does not happen when using system's
cp
command. I'm wondering if this is the correct behavior and if so, it should probably be documented better.Meta
rustc --version --verbose
: