Comments (5)
No problem! I see why you would want to do that.
If you'd like to build entr
from source it can be easily patched. Something like this:
diff --git a/missing/kqueue_inotify.c b/missing/kqueue_inotify.c
index 7891dda..eaa5d2b 100644
--- a/missing/kqueue_inotify.c
+++ b/missing/kqueue_inotify.c
@@ -81,7 +81,7 @@ fs_sysctl(const int name) {
#define EVENT_SIZE (sizeof (struct inotify_event))
#define EVENT_BUF_LEN (32 * (EVENT_SIZE + 16))
-#define IN_ALL IN_CLOSE_WRITE|IN_DELETE_SELF|IN_MOVE_SELF|IN_MOVE|IN_ATTRIB|IN_CREATE|IN_DELETE
+#define IN_ALL IN_MODIFY|IN_DELETE_SELF|IN_MOVE_SELF|IN_MOVE|IN_ATTRIB|IN_CREATE|IN_DELETE
/*
* inotify and kqueue ids both have the type `int`
@@ -193,7 +193,7 @@ kevent(int kq, const struct kevent *changelist, int nchanges, struct
/* convert iev->mask; to comparable kqueue flags */
fflags = 0;
if (iev->mask & IN_DELETE_SELF) fflags |= NOTE_DELETE;
- if (iev->mask & IN_CLOSE_WRITE) fflags |= NOTE_WRITE;
+ if (iev->mask & IN_MODIFY) fflags |= NOTE_WRITE;
if (iev->mask & IN_CREATE) fflags |= NOTE_WRITE;
if (iev->mask & IN_DELETE) fflags |= NOTE_WRITE;
if (iev->mask & IN_MOVE_SELF) fflags |= NOTE_RENAME;
from entr.
This is as intended:
On Linux entr
waits until the file closed (IN_CLOSE_WRITE
) so that it does not launch utilities before a file is completely written. (Downloading a file for example.)
Unfortunately kqueue does not prove this insight, so on BSD entr
may run the utility on a file that is partially written.
from entr.
That's a shame :(
I don't mind entr
reacting to each small file change. In my script I use sleep
at the beginning, before I process the modified file. That way I give time for the serial transmission to finish. I ended up using the when-changed
utility. But I think it would be nice for entr
to have this functionality as well.
I understand your reasoning, but I think it would be great to have a switch for this behavior.
from entr.
entr
is a test runner, so the primary objective is to avoid spurious changes by collapsing events so that
- a build is not triggered prematurely
- a build is only invoked only once
What your use case? If you're looking to respond to all events, perhaps inotifywait
is the right tool
inotifywait -q -e modify testfile.log --format "%w%f"
from entr.
Thank you very much. It is even able to react to changes in all files in a folder:
inotifywait -q -e modify SerialLogs/ --format "%w%f"
My use case is that I capture logs from a serial console of an embedded devices, and want to send an email when any of the devices resets. So I want some tool that will notice a change in the log file, so I'm able to grep it for more details and then take further actions.
I think for now I'll stay with the when-changed
utility since it works the way I need it and also is able to directly execute a command like entr
does. But if it turns out I need more control over what is happening, then I'll go with the inotifywait
route.
Thank you for taking the time to help me!
from entr.
Related Issues (20)
- Enhancement: Report changed path HOT 6
- Current working directory is set to /usr/sbin when using fish? HOT 4
- `make test` error: "./system_test.sh: 19: Syntax error: "}" unexpected" HOT 12
- Feature request: ring terminal bell after command finishes HOT 5
- entr is running twice HOT 5
- Tests are failing on archlinux HOT 3
- Minor doc proposal: A sentence to be explicit about some uses of '-s' HOT 2
- Error when running make install ../data.h: No such file or directory HOT 4
- How to deal with user input? HOT 8
- `-r` option seems to force reboot on MacOS HOT 6
- entr: No regular files to watch in ruby HOT 8
- Alternatives to SIGTERM with -r HOT 11
- Use strlcpy with >=glibc-2.38 HOT 9
- Missing entr command on website HOT 1
- Ability to kill the process after a timeout if it fails to stop gracefully HOT 7
- `/_` marker and quotes. HOT 2
- I just cannot make entr run two (or more) commands when triggered? HOT 2
- Is there a entr alternative for Windows? HOT 4
- Using redirection with entr HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from entr.