Repository navigation
[codex] jq: defer stdin reads for null input - #776
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ca22d872d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Addressed in |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 793c12ed53
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Follow-up addressed in |
Summary
jq -ndoes not consume stdin before the query actually requestsinputorinputsinputbehaviorRoot Cause
The current jq implementation eagerly called
readJQInputSourceswhile building the iterator passed togojq.WithInputIter. Forjq -n, that meant stdin was consumed during setup even though the main query input had already been swapped tonull. Insidewhile read ... done < <(...)loops, the eager read stole the next loop item from stdin and broke the Harness overlay example.Impact
This restores expected
jq -nbehavior onmainand unblocks the Harness overlay flow that shells out to jq while iterating lines from process substitution.Validation
go test ./contrib/jqgo run ./examples/harness-overlay --script ...in a disposablemain-based worktree with the example cherry-pickedgo test ./examples/harness-overlayin that disposable worktree