Skip to main content
edited title
Link

Multiple pipes on a tailed log aren't handled- last pipe never receives stdin

Source Link

Multiple pipes on a tailed log aren't handled

I've gotten into an interesting state on Ubuntu. The steps below describe it the best.

With a single pipe, I'm seeing what I expect

# In shell A
tail -f foo.log | grep aaa

# In shell B
echo aaa >> foo.log

# Shell A prints out `aaa`

But with multiple pipes I'm not seeing anything at all

# In shell A
tail -f foo.log | grep aaa | grep bbb

# In shell B
echo aaa bbb >> foo.log

# Nothing ever prints in shell A

But it works fine if I'm just echoing.

echo 'aaa bbb' | grep aaa | grep bbb

This is my attempt to create a minimal reproduction -- I originally encountered the issue trying to tee logs from adb logcat (Android dev tools). I've tried in zsh, bash, and fish as well.

I assumed it has something to do with my inotify watcher limit but bumping it didn't change anything.