Repository navigation
fix(jq): ignore unread invalid stdin under -n - #2660
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | aaf5529 | Commit Preview URL Branch Preview URL |
Oct 09 2026, 04:37 PM |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Михайло · project thread
What changed
With
-n,jqno longer reports invalid JSON on stdin that the filter never reads. A stdin parse error is reported only afterinputorinputsreads past the last valid value, which matches jq 1.7.Why
jq -nis the usual way to build JSON from--argvalues. Scripts often run it while stdin holds something else, such as a pipe or awhile readloop's here-doc. bashkit printed the right output, then addedjq: invalid JSON ...and exited 5. That breaksset -escripts that work under real bash. Found during the BashBox re-run (#2657).Before/After (verified)
"x", thenrc=0, then"one".jq: invalid JSON: expected ident ..., and the first command ended withrc=5.The following cases behave the same as jq 1.7:
printf '1 x' | jq -n inputprints1with status 0.printf '1 x' | jq -n '[inputs]'still fails with status 5.Risk
Low. The change only applies with
-n, and only to whether a parse error is reported. Values are still parsed eagerly as before.Checklist
null_input_ignores_unread_invalid_stdin,null_input_reports_invalid_stdin_once_reached)-D warnings, fmtGenerated by Claude Code