Codebase list entr / aac2491b-0cf0-4f2d-be7b-352a47e1bfa0/main
[ Yuri D'Elia ] [ Debian Janitor ] New upstream release. Debian Janitor 2 years ago
6 changed file(s) with 67 addition(s) and 53 deletion(s). Raw diff Collapse all Expand all
00 PREFIX ?= /usr/local
11 MANPREFIX ?= ${PREFIX}/man
2 RELEASE = 4.8
2 RELEASE = 4.9
33 CPPFLAGS += -DRELEASE=\"${RELEASE}\"
44
55 all: versioncheck entr
00 = Release History
1
2 == 4.9: May 3, 2021
3
4 - EV_TRACE also prints file/notify descriptor limit
5 - Don't raise rlim_cur on MacOS
6 - Set 2^16 watches if inotify limits cannot be read
7 - Raise an error and suggest '-n' if terminal attributes cannot be read
18
29 == 4.8: February 26, 2021
310
3535
3636 Launch and auto-reload a node.js server:
3737
38 $ find . -name '*.js' | entr -r node app.js
38 $ ls *.js | entr -r node app.js
3939
4040 Clear the screen and run a query after the SQL script is updated:
4141
42 $ echo my.sql | entr -p psql -f /_
42 $ echo my.sql | entr -cp psql -f /_
4343
4444 Rebuild project if a source file is modified or added to the src/ directory:
4545
46 $ while sleep 0.1; do find src -name '*.rb' | entr -d make; done
46 $ while sleep 0.1; do ls src/*.rb | entr -d make; done
4747
48 Self-terminate after a file is updated
48 Auto-reload a web server, or terminate if the server exits
4949
50 $ find . -type f | entr -p 'kill $PPID'
50 $ ls * | entr -rz ./httpd
5151
5252 News
5353 ----
0 entr (4.8-1) UNRELEASED; urgency=medium
0 entr (4.9-1) UNRELEASED; urgency=medium
11
2 [ Yuri D'Elia ]
23 * New upstream version 4.8:
34 - Use control sequences to clear the display and specify '-c' twice to erase
45 the scrollback buffer
56
6 -- Yuri D'Elia <wavexx@thregr.org> Fri, 02 Apr 2021 17:54:54 +0200
7 [ Debian Janitor ]
8 * New upstream release.
9
10 -- Yuri D'Elia <wavexx@thregr.org> Sat, 05 Jun 2021 06:52:25 -0000
711
812 entr (4.7-1) unstable; urgency=medium
913
105105 int
106106 main(int argc, char *argv[]) {
107107 struct rlimit rl;
108 rlim_t max_watches;
109108 int kq;
110109 struct sigaction act;
111110 int ttyfd;
113112 int n_files;
114113 int i;
115114 struct kevent evSet;
116 long open_max;
115 unsigned open_max;
117116
118117 if ((*test_runner_main))
119118 return(test_runner_main(argc, argv));
158157 if (sigaction(SIGCHLD, &act, NULL) != 0)
159158 err(1, "Failed to set SIGCHLD handler");
160159
161 getrlimit(RLIMIT_NOFILE, &rl);
162
163160 #if defined(_LINUX_PORT)
164 max_watches = (rlim_t)fs_sysctl(INOTIFY_MAX_USER_WATCHES);
165 if(max_watches > 0) {
166 rl.rlim_cur = max_watches;
167 open_max = max_watches;
168 goto rlim_set;
169 }
170 #endif
171 /* raise soft limit */
172 open_max = min(sysconf(_SC_OPEN_MAX), (long)rl.rlim_max);
173 if (open_max == -1)
174 err(1, "_SC_OPEN_MAX");
175
176 open_max = min(524288, open_max); /* guard against unrealistic replies */
177
161 /* attempt to read inotify limits */
162 open_max = (unsigned)fs_sysctl(INOTIFY_MAX_USER_WATCHES);
163 if (open_max == 0)
164 open_max = 65536;
165 #elif defined(_MACOS_PORT)
166 /* guard against unrealistic replies */
167 open_max = min(65536, (unsigned)rl.rlim_cur);
168 if (open_max == 0)
169 open_max = 65536;
170 #else /* BSD */
171 if (getrlimit(RLIMIT_NOFILE, &rl) == -1)
172 err(1, "getrlimit");
173 open_max = (unsigned)rl.rlim_max;
178174 rl.rlim_cur = (rlim_t)open_max;
179175 if (setrlimit(RLIMIT_NOFILE, &rl) != 0)
180 err(1, "setrlimit cannot set rlim_cur to %ld", open_max);
181
182 rlim_set:
176 err(1, "setrlimit cannot set rlim_cur to %u", open_max);
177 #endif
178
179 if (getenv("EV_TRACE"))
180 fprintf(stderr, "open_max: %d\n", open_max);
183181
184182 /* prevent interactive utilities from paging output */
185183 setenv("PAGER", "/bin/cat", 0);
203201 errx(1, "No regular files to watch");
204202 if (n_files == -1)
205203 errx(1, "Too many files listed; the hard limit for your login"
206 " class is %ld. Please consult"
204 " class is %u. Please consult"
207205 " http://eradman.com/entrproject/limits.html", open_max);
208206 for (i=0; i<n_files; i++)
209207 watch_file(kq, files[i]);
218216 }
219217
220218 /* remember terminal settings */
221 tcgetattr(STDIN_FILENO, &canonical_tty);
219 if (tcgetattr(STDIN_FILENO, &canonical_tty) == -1)
220 errx(1, "unable to get terminal attributes, use '-n' to run non-interactively");
222221
223222 /* Use keyboard input as a trigger */
224223 EV_SET(&evSet, STDIN_FILENO, EVFILT_READ, EV_ADD, NOTE_LOWAT, 1, NULL);
260259 void
261260 handle_exit(int sig) {
262261 if (!noninteractive_opt)
263 xtcsetattr(0, TCSADRAIN, &canonical_tty);
262 xtcsetattr(STDIN_FILENO, TCSADRAIN, &canonical_tty);
264263 terminate_utility();
265264 if ((sig == SIGINT || sig == SIGHUP))
266265 exit(0);
600599
601600 main:
602601 if (!noninteractive_opt)
603 xtcsetattr(0, TCSADRAIN, &character_tty);
602 xtcsetattr(STDIN_FILENO, TCSADRAIN, &character_tty);
604603 if ((reopen_only == 1) || (collate_only == 1)) {
605604 nev = xkevent(kq, NULL, 0, evList, 32, &evTimeout);
606605 }
639638 dir_modified += compare_dir_contents(file);
640639 }
641640 if (!noninteractive_opt)
642 xtcsetattr(0, TCSADRAIN, &canonical_tty);
641 xtcsetattr(STDIN_FILENO, TCSADRAIN, &canonical_tty);
643642
644643 collate_only = 0;
645644 for (i=0; i<nev; i++) {
220220 fi
221221
222222 try "exec single utility when an entire stash of files is reverted"
223 setup
224 cp /usr/include/*.h $tmp/
225 cd $tmp
226 git init -q
227 git add *.h
228 git commit -m "initial checkin" -q
229 for f in `ls *.h | head`; do
230 chmod 644 $f
231 echo "" >> $f
232 done
233 cd - > /dev/null ; zz
234 ls $tmp/*.h | ./entr -p echo "changed" > $tmp/exec.out &
235 bgpid=$! ; zz
236 cd $tmp
237 git checkout *.h -q
238 cd - > /dev/null ; zz
239 kill -INT $bgpid
240 wait $bgpid || assert "$?" "130"
241 assert "$(cat $tmp/exec.out)" "changed"
223 if [ ! -d /usr/include ]; then
224 skip "Operating system does not include files in a standard location"
225 else
226 setup
227 cp /usr/include/*.h $tmp/
228 cd $tmp
229 git init -q
230 git add *.h
231 git commit -m "initial checkin" -q
232 for f in `ls *.h | head`; do
233 chmod 644 $f
234 echo "" >> $f
235 done
236 cd - > /dev/null ; zz
237 ls $tmp/*.h | ./entr -p echo "changed" > $tmp/exec.out &
238 bgpid=$! ; zz
239 cd $tmp
240 git checkout *.h -q
241 cd - > /dev/null ; zz
242 kill -INT $bgpid
243 wait $bgpid || assert "$?" "130"
244 assert "$(cat $tmp/exec.out)" "changed"
245 fi
242246
243247 try "exec utility when a file is written by Vim"
244248 setup