3 ms·
I use entr for all my file-watching needs, if I need a roll-my-own solution. This article is a good introduction to the main ways to use it. If you use Vim, ho
by leephillips 5y ago
I use entr for all my file-watching needs, if I need a roll-my-own solution. This article is a good introduction to the main ways to use it.
If you use Vim, however, its defaults can interfere with auto-build setups that depend on file watching: https://lee-phillips.org/badvim/ https://lee-phillips.org/badvim/
- melissalobos 5y agoAnother solution is just to use inotify-tools and inotify-watch and wrap that in a while true with your commands after. But I like this solution much more.
- stephen_cagle 5y agoI use `entr` all the time for feedback on testing and development. Have you found a way to get it to handle "new" files. It is very good at watching a group of files, but my memory of it is that it barfs when you add/remove files? > ls *.clj | entr -rcs './problem01.clj < input01.txt' The problem is that ls only returns the list of files that existed at the time it was run...
- leephillips 5y agoThere is an example of how to do that in the article, using `entr -d`.
- stephen_cagle 5y agoNot a huge deal, but this "exits" when you have a change to a directory. So you end up having to put the whole thing in a while loop. But then you can't capture SIGINT and now you have to kill the process. So you need to write something that can capture that and conditionally break the loop if it is such... entr is focused on doing what it does well, and I don't have a solution here. Just feels like there should be something to handle that use case.
- junon 5y agoUse -d and a while loop. Keep in mind, this is a limitation of filesystem watchers, not entr specifically. It'd would have to do some juggling whenever a file was added.