watchexec / cargo-watch

Watches over your Cargo project's source.
Creative Commons Zero v1.0 Universal
2.78k stars 81 forks source link

Ignore watch events for certain duration or when shell is executing #305

Closed mez0ru closed 6 months ago

mez0ru commented 6 months ago

I'm using cargo watch with other scripts. For example, I need to run tailwindcss to execute when my rs files change because I use tailwindcss templating in rust. But the problem is that when tailwindcss outputs the resulted css, the cargo detects this change and rerun again. The best solution is to make it ignore watch events during execution. I use make to execute a lot of scripts together.

the command I use:

cargo watch -- make run

Makefile:

run:
    bun dev
    cargo run

The --delay option unfortunately doesn't ignore changes files are being changed during the duration. I tried to increase it to 5 seconds but it only delays the actual execution, it will execute multiple times, since multiple commands are changing files.

Is there a feature that lets me do this?

mez0ru commented 6 months ago

Nevermind, I solved my problem using ignore pattern -i to ignore my public folder.