Repository navigation
Keep Ctrl+C working in the SQL shell after multi-line statements - #40876
ahmedabu98 wants to merge 1 commit into
Conversation
sqlline 1.4 has JLine 2 undefine the terminal's interrupt character while it reads a line, then restore a value read from a stty cache that can already say "undefined". Ctrl+C then stopped reaching running statements, so the cancel from apache#40666 never ran. Restore the character captured at startup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
📋 Review Summary
This PR fixes an issue in the Beam SQL shell where Ctrl+C stops cancelling running queries after a multi-line statement is entered. It works around JLine 2's 1-second stty -a output cache in UnixTerminal by registering an InterruptRestoringTerminal that captures the intr setting once during terminal initialization and reliably restores it after each line read.
🔍 General Feedback
- The root cause analysis of JLine 2's
TerminalLineSettingscaching interaction withUnixTerminal.disableInterruptCharacter()during multi-line reads is spot on, and theInterruptRestoringTerminalworkaround is clean and minimal. - Removing
permitUnusedDeclared "jline:jline:2.14.6"inbuild.gradleproperly reflects the new direct usage of JLine classes inBeamSqlLine.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40876 +/- ##
=============================================
+ Coverage 0 64.16% +64.16%
- Complexity 0 2359 +2359
=============================================
Files 0 321 +321
Lines 0 15628 +15628
Branches 0 2032 +2032
=============================================
+ Hits 0 10027 +10027
- Misses 0 4833 +4833
- Partials 0 768 +768
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Follow-up to #40666. After a multi-line statement, sqlline 1.4's JLine 2 can leave the terminal's interrupt character undefined, so Ctrl+C no longer cancels a running statement. The shell now uses a Unix terminal that always restores the interrupt character it captured at startup.
🤖 Generated with Claude Code