Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

block: always drain stdout #425

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zsugabubus
Copy link

If input is not being read until EAGAIN, we will not get informed
(signaled) when further input arrives.

Fixes #422.

If input is not being read until `EAGAIN`, we will not get informed
(signaled) when further input arrives.
vivien added a commit that referenced this pull request Jan 13, 2023
i3blocks currently wrongly assumes that a persistent program will
be line buffered (or act as such) and flush one line at a time. In
this common scenario, it is safe to read a single line per signal,
but there are cases where this behavior is not not wanted.

For example, a program may print several lines at once, resulting in
updating only the first line, while filling up the pipe and eventually
have the block program hang on the next write operation.

To fix this, drain the pipe of a persistent block upon reception of
a signal, but line by line to avoid breaking non JSON blocks.

Also make sure to update a block only after having successfully read
its output, to avoid resetting a block on error such as on incomplete
line, or when the pipe was already flushed.

Closes #422
Refs #425
dllud pushed a commit to dllud/i3blocks that referenced this pull request Jan 12, 2024
dunst: update documentation to reflect 99725fb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

xtitle -s hangs from time to time
1 participant