Hi,
I try this simple example :
watchmedo shell-command --patterns="*.bin" --command 'copytoserver.bat'
which works quite well : when a .bin is created on the current directory, copytoserver.bat is executed TWICE, not just ONCE
Is it an issue or I am missing something in probiding good arguments ?
Thanks for help
Gilles
Indeed, that's happening.
On Linux, a simple touch filename
would emit 2 messages: a file creation and a file modification, if the file doesn't exist. Probably the same is happening in Windows, and that's why it's running twice instead of once.
Saving it on vim
here with some arbitrary made it run 11 times. Probably that's because it's including file deletion, temporary file creation and renaming.
Probably it would be better to split this project into 2: the library (watchdog
) and the shell application (watchmedo
). I'm not aware how many users relies on both, but perhaps the event filtering shouldn't be the same on both, and that might become a burden to maintain.
I've fixed this issue on dose by adding a single runner with a "debouncer" that:
Actually, that was so fast that used to break watchdog on Linux due to a strange event happening on a deleted directory, so I fixed it upstream.
But, that's an issue regarding a single runner triggered by an event. It's an application (like the watchmedo shell-command
command). If we wanted to have distinct actions for distinct events, with some of them perhaps running in parallel, filtering out the events that happen to be close in time would be a mistake. That said, the problem isn't in the watchdog
library, but in watchmedo
.
I had the same problem, and a quick workaround was to use flock -n test.lock CMD
to make sure the process could only run once
Most helpful comment
I had the same problem, and a quick workaround was to use
flock -n test.lock CMD
to make sure the process could only run once