This is causing significant problems for script portability between BSD and Linux.
I am on a CentOS 6.4 where this happens.
I have a nice compact test case:
bash -c "inotifywait -mcr . | sed s/CLOSE/z/"
ps uf and observe:
\_ bash -c inotifywait -mcr . | sed s/CLOSE/z/ \_ inotifywait -mcr . \_ sed s/CLOSE/z/
Then, find the PID of the bash parent process, kill it.
Notice how the shell prompt has come back, indicating our shell's done waiting on its child.
But if you do anything on the filesystem to trigger inotify to report more events, it continues to dump to the terminal. On OS X, this does not happen because they would all be dead.
ps uf again. See that both inotifywait and sed are now children of
This seems totally wrong to me.
What does POSIX say about this?