Don't mask a sync error with NoMethodError when there is no TTY - #20
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
`Sync#now` rescues a failed sync and calls `post_error_clean_up`, which does `$stdin.gets.chomp.downcase`. Run non-interactively (CI, cron, a piped `rake`), `$stdin.gets` returns `nil`, so `nil.chomp` raises `NoMethodError` from inside the rescue -- replacing the real error with a confusing one and skipping the `raise`. Guard the `nil`: with no TTY, keep the temp files and let the original error surface. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GtYgwYNfJ3wHrw9xrooVoB
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.
The bug
Sync#nowwraps the sync inrescue => errorand callspost_error_clean_up:Run non-interactively — CI, cron,
rake icons:sync | tee log—$stdin.getsreturnsnil, sonil.chompraisesNoMethodError. Because this runs inside therescue, it replaces the real sync failure and skips theraiseat the end ofnow.The fix
Guard the
nil. With no TTY, keep the temp files (the safe default) and let the original error propagate.Tests
sync_test.rb—post_error_clean_upwith an empty/EOF stdin keeps the files (noNoMethodError); with"y"it still removes them. The first fails onmain(NoMethodError).bundle exec rakeis green (91 runs, 0 failures).🤖 Generated with Claude Code