-
Notifications
You must be signed in to change notification settings - Fork 182
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
i3blocks freezes when clicking clickable blocklet, while having other blocklets with fish scripts as command #288
Comments
Which i3blocks version do you use? I recently encountered exactly the same issue and found that this was caused by a single block (an own script). If I disable that one, everything is fine. I did not yet figure out what the actual problem is, though. Could you check if you can verify that a single block is causing this? |
My version is 1.4. |
Ok, it seems it doesn't like my referenced fish scripts in two blocklets. Switching the shebang to bash does the trick. Still weird why fish isn't supported. |
I have the same problem but don't have any fish scripts. For me, removing this block solves the problem. Not sure why though.
Here is my shell script #!/usr/bin/sh
count=$(ssh homeServer -t checkupdates 2> /dev/null | wc -l )
if [ "$count" = "0" ]; then
echo ""
echo ""
echo ""
else
echo $count
echo $count
if [ "$count" -gt "5" ]; then
echo "#FFOOOO"
else
echo "#FF8000"
fi
fi Edit: It was pointed out that changing to bash might help, this didn't fix it for me. |
Doesn't echo print a newline by default? I think i3blocks can't handle more than one line. Try to use |
Thanks, unfortunately that didn't work. FYI, i3 blocks will use the first 3 lines of stdout. http://vivien.github.io/i3blocks/#COMMAND
|
Ah, I see. Didn't know that, thanks. Sorry that I couldn't be of any help.. |
Guys do you still have an issue? Especially with latest i3blocks master? I have trouble identifying your issue here. If you still have an issue, are you able to provide me a minimal example so that I can reproduce it? Thank you! P.S.: @Jab2870 I like the |
@vivien Yes, still happens with #!/usr/bin/fish
cat /proc/cpuinfo | grep MHz | awk '
BEGIN { a = 0 }
{
if ($4 > a) {
a = $4
}
} The breaking blocklet itself doesn't have to be clickable, and it's completely irrelevant which block is clicked. What I suspect is that the passed click variables can't be parsed/computed in fish, and the process freezes.. |
This script doesn't print anything. Please provide a working example as well as the corresponding block config. Thank you! |
Seems to be a different cpuinfo format for you. I will post both requested things tomorrow. |
@vivien I am still getting the issue. My working example is above. I have installed i3blocks-git from the aur. I assume it is the newest version because all of my labels have disappeared. Is this to be expected? I can open a new issue if not. |
OK I can reproduce the issue. For some reasons, once processes like fish or ssh are forked, the parent's stdin is messed up, making it blocking again (regardless O_NONBLOCK). So i3blocks gets stuck on click processing. command=fish -c date # mess stdin
command=ssh foo date # mess stdin
command=bash -c date # works fine
interval=once I'm investigating this. |
Ok, glad you could reproduce it. Hope you're able to fix it soon. fish is sometimes a little weird, but the auto-complete and history is just perfect for me.. |
When forking processes, the best practice is to close the standard input from within the child process and reopen /dev/null or a pipe to provide a valid file descriptor 0. Another solution would've been to set the FD_CLOEXEC flag on the parent's standard input so that the child stdin gets automatically closed when a process is executed. A valid file descriptor 0 still needs to be somehow provided though. Both solutions fix a weird behavior caused by processes like "fish -c date" messing around with the parent standard input through the duplicated child stdin and making it blocking again, freezing i3blocks. This commit implements the second solution for reference even though the former solution is already implemented. This doesn't hurt to have both since the child standard input won't be closed again if it already is. Refs #288
This problem came from the duplicated standard input shared between the parent (i3blocks) and the child (e.g. To fix this the best practice is to close and reopen a dummy standard input in the child process. The commit a586a34 does that. Another solution is to close stdin on exec, as commit d376075 does. Both solutions can coexist and are implemented now. |
This is sorted for me, thanks for fixing this. |
Thanks, i had this problem with ruby scripts
It's work for me. |
I don't know why this work, but it's discussed here: vivien/i3blocks#288
When using e.g. the example blocklet from the README:
Here's the journal log from right before the click happens.
And then.. it freezes (values don't get updated anymore, e.g. time blocklet stops working.
Here's the full journal after restarting i3:
https://hastebin.com/mewinezoco.vbs
The text was updated successfully, but these errors were encountered: