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

Output issue with tail + jq #1097

Closed
soywod opened this issue May 7, 2021 · 2 comments
Closed

Output issue with tail + jq #1097

soywod opened this issue May 7, 2021 · 2 comments

Comments

@soywod
Copy link

soywod commented May 7, 2021

When a custom script is piped to jq, the output seems to be discard:

echo 42 > /tmp/file
"custom/script": {
    "exec": "tail -f /tmp/file | jq -r '.'"
},

If I execute this command in my terminal I see well 42. But it does not show 42 in the bar.
If I replace the command with echo 42 | jq -r '.', it works.
If I replace the command with tail -f /tmp/file it also works.

Any clue on what's going on there?


waybar -v: Waybar v0.9.5
uname -a: Linux workstation 5.10.11-arch1-1 SMP PREEMPT Wed, 27 Jan 2021 13:53:16 +0000 x86_64 GNU/Linux

@YerinAlexey
Copy link

YerinAlexey commented May 15, 2021

You should use jq --unbuffered in this case, this way jq will print the results immediately instead of buffering them until the file (well, tail -f pipe) closes

@soywod
Copy link
Author

soywod commented May 15, 2021

Works like a charm, thanks for the help!

@soywod soywod closed this as completed May 15, 2021
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

No branches or pull requests

2 participants