seb-m / pyinotify

Monitoring filesystems events with inotify on Linux.
http://github.com/seb-m/pyinotify/wiki
MIT License
2.29k stars 379 forks source link

Invoked shell command is in zombie state after termination #112

Open ymattw opened 8 years ago

ymattw commented 8 years ago

Should call wait() for the forked process.

% touch /tmp/input.log
% /bin/pyinotify -e IN_MODIFY -f /tmp/input.log -c 'sleep 1' & sleep 2; echo foo > /tmp/input.log
[1] 27363
<Event dir=False mask=0x2 maskname=IN_MODIFY name='' path=/tmp/input.log pathname=/tmp/input.log wd=1 >
<Event dir=False mask=0x2 maskname=IN_MODIFY name='' path=/tmp/input.log pathname=/tmp/input.log wd=1 >

% ps -ef f
[...]
ymattw   26055     1  0 08:59 ?        Ss     0:00 tmux
ymattw   26056 26055  0 08:59 pts/0    Ss     0:00  \_ -zsh
ymattw   27079 26056  0 09:08 pts/0    S+     0:00  |   \_ /bin/bash /bin/pyinotify -e IN_MODIFY -f /tmp/input.log -c sleep 1
ymattw   27080 27079  0 09:08 pts/0    S+     0:00  |       \_ python -m pyinotify -e IN_MODIFY -f /tmp/input.log -c sleep 1
ymattw   27092 27080  0 09:08 pts/0    Z+     0:00  |           \_ [sleep] <defunct>