fix: prevent statusline example script from hanging on blocked stdin - #699
fix: prevent statusline example script from hanging on blocked stdin#699akunzai wants to merge 1 commit into
Conversation
The example script read stdin unbounded (jq reading directly from the
live pipe). During auth/OAuth refresh or resume-conversation warm-up,
the CLI's statusline runner can hold stdin open without writing or
closing it, so the script hangs until the runner's ~5-10s hard kill
(signal: killed), and enough consecutive kills auto-disables the
custom statusline.
Read stdin with a short timeout up front, close it immediately after
(exec 0</dev/null) so nothing later can block on it, and default to
"{}" when no input arrived in time so the rest of the script still
renders a degraded status line instead of crashing on empty read.
Closes google-antigravity#698
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
|
Hi @google-antigravity team and contributors! 👋 Great catch and fix in this PR regarding We have independently analyzed this issue and confirmed that when the CLI runner holds We have integrated this exact fix and enhanced resilience across both Bash (
Key Improvements in v0.2.3:
If anyone is looking for a production-ready, feature-rich statusline plugin with dynamic line-packing, system resource telemetry, and built-in stdin hang protection, feel free to try antigravity-cli-statusline! Kudos to the author for initiating this fix! 🚀 |

Summary
examples/statusline/statusline.shreads stdin unbounded (jqreads directly from the live pipe). During auth/OAuth refresh or resume-conversation warm-up, the CLI's statusline runner can hold stdin open without writing or closing it, so the script hangs until the runner's ~5-10s hard kill (statusline: command failed: signal: killed). Enough consecutive kills auto-disables the custom statusline.run_with_timeout 0.25 cat, with a portable fallback when GNUtimeoutisn't available) and close stdin immediately after (exec 0</dev/null) so nothing later in the script can block on it.JSON_INPUTto"{}"when nothing arrived in time, so the script still renders a degraded status line instead of crashing on an emptyread.timeout 5kills it (exit 124, ~5s); after the fix it returns in ~0.27s with a valid degraded render (exit 0). Normal JSON input on stdin still renders exactly as before.Closes #698
Test plan
bash -n examples/statusline/statusline.sh