Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

watchmedo only triggers once (and sometimes not even once) #711

Closed
cglacet opened this issue Dec 1, 2020 · 5 comments
Closed

watchmedo only triggers once (and sometimes not even once) #711

cglacet opened this issue Dec 1, 2020 · 5 comments

Comments

@cglacet
Copy link

cglacet commented Dec 1, 2020

I have a problem I can't manage to identify, I'm not sure it's a bug with watchmedo command tho.

When I run the following:

poetry run watchmedo shell-command \
    --patterns='*.rst;*.py' \
    --ignore-pattern='public/*' \
    --command='echo test' \
    --recursive

Everything works as expected and any change triggers the echo command, on the other hand, if I change echo test by poetry run python -m sphinx -a -E -b html source public (which on its own work without any issue, ie., error code is 0) I get strange behaviours.

Most of the time the first change triggers documentation build as expected. Subsequent changes will never trigger and the command build will not be executed anymore.

Any clue what could be causing this?

EDIT I also test with this command poetry run python -m sphinx -a -E -b html source public && echo status $? just to make sure everything went well even when started from the first auto-trigger. And it also printed status 0.

2nd EDIT I found a command you can try at home and produces similar (unexpected) results:

❯ poetry run watchmedo shell-command \
                --patterns='*.rst;*.py' \
                --ignore-pattern='public/*' \
                --command='echo test && sleep 10 && echo ok' \
                --recursive

After the first edit, this should print test \n ok then it will stop triggering after subsequent edits.

3rd EDIT using --debug-force-polling seems to prevent this bug from appearing (both in the sphinx build and sleep 10 cases), no idea what that does 🤣

@CCP-Aporia
Copy link
Contributor

Which operating system are you running on? :-)

@cglacet
Copy link
Author

cglacet commented Dec 12, 2020

Osx, catalina I think is the name. If you need more details I can check once I'm back on my laptop.

@CCP-Aporia
Copy link
Contributor

Great, thanks! Then the problem is most likely with the fsevents based observer that is the default on macOS. You could also try using the kqueue based observer (--debug-force-kqueue) which should perform better than the polling one.

@josemonsalve2
Copy link

Hello,

I am having the same issue, but when using the python module. Is there a way to force kqueue in python?

Thanks

@samschott
Copy link
Contributor

I think this can be closed following the release of 2.0.

@BoboTiG BoboTiG closed this as completed Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants