Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
block: drain persistent pipe line by line
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
- Loading branch information
Showing
3 changed files
with
61 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters