![]() DYLD_INSERT_LIBRARIES is a thing on macOS, though it is subject to SIP restrictions with some binaries. On Linux, ptrace/LD_PRELOAD would enable us to know the set of all files changed as a result of running the file watcher (and thus ignoring them automatically). Unfortunately OSes don't provide great info when it comes to file modifications. watchexec did good work here by ingesting your. Currently, most tools require you to tell it files/patterns to ignore to avoid triggering loops where the file watcher changes files and ends up triggering itself over and over. The only real improvement that can be made to these tools (currently) would be to have perfect information about what caused a file to change. However, from a pure design standpoint, entr is just better than most anything out there due how closely it hews to UNIX philosophy, and it gets so far on just that. Watchexec was borne out of a few frustrations with entr, mostly around how it handles new files being created. If you know of a supported way of doing this on Linux I'd really love to know! It will allow me to finally make the program I wanted to make! rerun updatedb if you are using locate), but then your searches are much slower and the benefit of indexing for a quick search is reduced significantly.Ī nicer API would allow to use one registration handle to get notifications for an entire directory tree or at least have a seprate API for an entire filesystem (like the NTFS option mentioned above).Īt least, that was the conclusion I came to when I last researched the topic. Alternatively, you can attempt to reindex right before searching (e.g. As a result, the Linux equivalent to Everything is unable to find recently created files, erronously finds deleted files and has outdated metadata fo recently changed files. Using inotify for that is not possible since you'd have to recursively register for hunderds of thousands of directories, which far exceeds the limit of allowed registerations (and either way, would be quite wasteful to hold 100,000 registration handles). This allows software like Voidtool's Everything to index the entire filesystem and update that index in real time. Not the original poster, but Windows allows you to get all changes in an NTFS volume, effectively allowing you to monitor notifications to an unlimited amount of files and directories (didn't remember what the feature was called, a quick googling led me to. And that’s not even with any parallel execution. Just looking at the last time I implemented something like this-it was watchman + about 500 lines of code figuring out which actions to run and when. But if there’s more than one command (usually the case!) then it gets far more complicated. If it’s just one command, sure, you could probably do it in an hour. A command may change state from being queued&ready to having outdated inputs. You need to execute commands in the correct order. The user doesn’t want to see errors from this and you generally want to rerun the command. The other program probably should atomically rewrite the file, but you’re stuck fixing the problem. You will sometimes see incomplete / corrupted versions of files, because you ran a command while another program was writing the file. ![]() You might want to delay triggers to see if more events arrive. Multiple files may change in quick succession, for example, if you hit “save all” in an editor. There are a number of cases you often want to handle: It’s a full workday for someone who already understands the problem. Not if you want it to work reasonably well and not be broken all the time. It is not even remotely a <1 hour project. The sort -r is required to ensure that files come after their respective directories, since longer paths come after shorter ones with the same prefix.I have implemented stuff like this. I haven't found a convenient analogue for -execdir with xargs: Xargs: change working directory to file path before executing? depth -execdir rename 's/_dbg.txt$/_.txt' '' Works directly only for suffixes, but this will work for arbitrary regex replacements on basenames: PATH=/usr/bin find. ![]()
0 Comments
Leave a Reply. |