tigrawap / slit

slit - a modern PAGER for viewing logs, get more than most in less time
Other
469 stars 18 forks source link

avoid an indefinite loop in refreshIfEmpty() #26

Closed olshevskiy87 closed 7 years ago

olshevskiy87 commented 7 years ago

if you pass something through the pipe, e.g. echo something | ./slit, cpu activity suddenly increases, because the break without label loop in refreshIfEmpty() function breaks switch operator only and slit hangs. I assume, that if config.isStdinRead() is true, we don't need to wait the stdin data anymore and we can leave cycle with break loop.

tigrawap commented 7 years ago

Nice catch... It actually was supposed to break loop, no point in breaking select only... So, a bug :)

You saying it also made process hang completely? I think reason for this is still there, could be race between block on requestRefresh <- struct{}{} and slit quit.

This refresh request should respect context to properly abort in case ctx is done. Step by step :)

olshevskiy87 commented 7 years ago

You saying it also made process hang completely?

yep