emcrisostomo / fswatch

A cross-platform file change monitor with multiple backends: Apple OS X File System Events, *BSD kqueue, Solaris/Illumos File Events Notification, Linux inotify, Microsoft Windows and a stat()-based backend.
https://emcrisostomo.github.io/fswatch/
GNU General Public License v3.0
4.96k stars 327 forks source link

fswatch + xargs work with almost any command but "open -a Yoink" #284

Closed hugows closed 2 years ago

hugows commented 2 years ago

Hello,

I'm trying to understand why the following happens (Mac), if anyone can help me. I wrote this command so what new files uploaded to the current folder were automatically added to yoink (a clipboard manager):

fswatch -0 . | xargs -0 -n 1 -I {} open -a Yoink {}

But, only with this specific command, this command will actually run every second once fswatch is triggered with a new file?

If I use:

fswatch -0 . | xargs -0 -n 1 -I {} say "new file"

it works (runs once). If I run:

fswatch -0 . | xargs -0 -n 1 -I {} code {}

it works, launching VsCode once with that file.

Any idea what could be going on?

hugows commented 2 years ago

Probably sopmething with Yoink changing file attributes every time the file is opened. Had to use another tool with a polling monitor.