eww icon indicating copy to clipboard operation
eww copied to clipboard

[BUG] Eww log output buffering doesn't work properly

Open ItsDrike opened this issue 2 years ago • 2 comments

Checklist before submitting an issue

  • [X] I have searched through the existing closed and open issues for eww and made sure this is not a duplicate
  • [X] I have specifically verified that this bug is not a common user error
  • [X] I am providing as much relevant information as I am able to in this bug report (Minimal config to reproduce the issue for example, if applicable)

Description of the bug

When running eww daemon --no-daemonize 2>&1, in some specific cases (mentioned in reproducing the bug), the output logs aren't properly buffered and are only displayed once the application is terminated, rather than being shown line by line, as these logs are produced.

This can end up causing issues in some scripts, that are trying to parse the this output in a pipe.

Reproducing the issue

Running eww daemon --no-daemonize 2>&1 | awk '{print}' | tee /dev/null doesn't produce any output, until eww is terminated with a SIGTERM (killall eww).

Similarly, and for the same reason, running eww daemon --no-daemonize 2>&1 | awk '{print}' >/path/to/my/file.txt does create the file.txt, however it leaves it empty until eww is terminated.

What's quite annoying is that while terminating with SIGTERM does work and causes eww to flush the output at least then, if eww is killed with SIGINT (with ctrl+c), this is not the case, and no output is produced at all. Making this issue pretty hard to debug.

Interestingly enough, this doesn't happen with any of:

  • eww daemon --no-daemonize 2>&1
  • eww daemon --no-daemonize 2>&1 | awk '{print}'
  • eww daemon --no-daemonize 2>&1 | tee /dev/null | awk '{print}'
  • eww daemon --no-daemonize 2>&1 | tee /dev/null | awk '{print} >/path/to/my/file.txt'

With which the output can be seen as it's produced in the real time.

I assume this is eww doing some internal buffering, because the usual fixes like:

  • stdbuf -oL /usr/local/bin/eww daemon --no-daemonize 2>&1 ...
  • stdbuf -o0 /usr/local/bin/eww daemon --no-daemonize 2>&1 ...

Don't work either.

Expected behaviour

The way output buffering is handled should be changed, and the output should be flushed after every new line.

Even though I did mention the commands

  • eww daemon --no-daemonize 2>&1 | tee /dev/null | awk '{print}'
  • eww daemon --no-daemonize 2>&1 | tee /dev/null | awk '{print} >/path/to/my/file.txt'

Which both work and are viable workarounds for this issue, it was pretty difficult to find out that these work, and users won't necessarily think to check the docs for an issue like this, so the solution probably shouldn't be just mentioning that this is a viable workaround, and instead the buffering behavior should be changed, to act in the way most other programs do, and how users would likely expect it to work.

Additional context

No response

ItsDrike avatar Feb 04 '23 20:02 ItsDrike

@ItsDrike Is this still an issue, with the latest version?

Chris

chrisdebian avatar Sep 01 '25 16:09 chrisdebian

@ItsDrike Is this still an issue, with the latest version?

Chris

Sorry, I don't use eww anymore

ItsDrike avatar Sep 01 '25 16:09 ItsDrike