fix: let split --dry-run run unattended instead of aborting on closed stdin - #173
Open
vitali87 wants to merge 1 commit into
Open
fix: let split --dry-run run unattended instead of aborting on closed stdin#173vitali87 wants to merge 1 commit into
vitali87 wants to merge 1 commit into
Conversation
… stdin The interactive editor ran unconditionally before the plan was saved, and typer.prompt turns the EOF from a closed stdin (scripts, CI, 'split --dry-run < /dev/null') into an Abort, so the documented automation mode exited 1 without saving anything - the repo's own scripts/score_pr.py had to work around it with input='done'. The editor is now skipped with a notice when stdin is not a TTY; click converts EOF to Abort inside the prompt itself, so the guard has to happen before prompting.
|
Warning Review limit reachedNext included review available in 6 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Summary
split --dry-run < /dev/null— the documented automation mode (preview + save plan) — exited 1 without saving anything. The interactive editor runs unconditionally before the plan is saved, and typer/click converts the EOF from a closed stdin into anAbortinside the prompt, so noexcept EOFErroraround it can help. The repo's ownscripts/score_pr.pyhad to work around this withinput="done\n"._interactive_editnow returns the plan as-is with a yellow notice whensys.stdin.isatty()is false, before any prompt. Interactive behaviour (including Ctrl+C → abort) is unchanged. Review verified with real subprocess runs: dry-run with closed stdin exits 0 and writes the plan; thescore_pr.pyworkaround still works; a non-dry-run split with closed stdin is still stopped by theProceed with creating branches and PRs?confirm gate before anything is created.Test plan
TestDryRunWithClosedStdindrives the real editor under CliRunner's non-TTY stdin (no_interactive_editpatch) — fails on main, passes here