4 ms·
I can't sing the praises enough of entr. Just check out its man page: http://eradman.com/entrproject/ http://eradman.com/entrproject/ entr lets you watch files
by macrael 5y ago
I can't sing the praises enough of entr. Just check out its man page: http://eradman.com/entrproject/ http://eradman.com/entrproject/
entr lets you watch files and re-run a command any time they change. Whenever I'm working on a script, or go tests, or whatever test-like thing I'm doing that's not in its own bloated test harness, I reach for entr. Great software, does what it's supposed to every time.
- jasim 5y agoI used to use entr extensively for Sketch plugin development (the vector editing tool by Bohemian Coding). However the app used to crash randomly and I felt my plugin was causing it. I spent an inordinate amount of time trying to debug it, replacing libraries, changing code and so on. Thankfully I noticed at some point that the app was behaving well for long durations of time when I started it without entr. I got rid of it from my toolchain and things have been well ever since. I still don't know the root cause, but now I know one more place to look for heisenbugs.
- Hello71 5y agoit looks like entr does a bunch of weird, potentially incompatible things, like redirecting stdin from /dev/tty and leaving FDs open in the child. however, my guess is that your build process is non-atomic, and your program is crashing due to necessary files being partially updated. this could probably be hacked around by doing something like `entr /bin/sh -c "sleep 1; exec realcommand"`.
- teitoklien 5y agoYou can do it with inotify too tho , no ? Great project tho !
- JeremyNT 5y ago'entr' will use inotify where available - the utility is that it's 1) cross-platform and 2) easy to integrate with shell scripting (rather than having to write a more complete inotify or other platform-specific tools). As an example, I use 'guard' [0] in a docker container, and on test failure it writes out to a file which is shared outside the container. It's easy for me to fire up a shell script that uses 'entr' to watch those files and pop up notifications when tests fail. [0] https://github.com/guard/guard https://github.com/guard/guard
- teitoklien 5y agoAh niceeeeee
- okamiueru 5y agoI didn't know of entr, or inotify at the time. Years ago, I wrote a script that did mostly that, but I've found myself to instead more often use a different script to rerun things based on manually triggered global hotkeys. It scratches a different itch, but in case you want to check it out: https://github.com/swarminglogic/shell-scripts/blob/master/runrerun/runrerun https://github.com/swarminglogic/shell-scripts/blob/master/r... In short, you set up a global hotkey to trigger the rerun of a "key"-ed command. Then you can quickly run a command, which can be rerun with that hotkey. So, a global hotkey set up for `runrerun -r foo` Then in a terminal you can use `runrerun -b foo -- <COMMAND>`. It is a bit over-engineered with multiple sessions, different kill signals for restarts, etc. But that's the gist of it.
- dorianmariefr 5y agoI use https://github.com/alexch/rerun https://github.com/alexch/rerun for that
- ducktective 5y agoThere is also `watchexec` [1]. However I don't know how it compares to `entr` or other inotify clients. [1] : https://github.com/watchexec/watchexec https://github.com/watchexec/watchexec
- umvi 5y agoI use a similar tool called reflex: https://github.com/cespare/reflex https://github.com/cespare/reflex