Repository navigation
fix: use cancellation signal in InteractiveContinuePrinter for proper Ctrl+C cleanup - #775
Merged
MarvinJWendt merged 1 commit intoApr 30, 2026
Conversation
… Ctrl+C cleanup InteractiveContinuePrinter calls internal.Exit(1) directly on Ctrl+C, which skips deferred cleanup and leaves the terminal in raw mode (broken prompt, invisible cursor). All other interactive printers (Select, Multiselect, TextInput) were fixed in pterm#383 to use NewCancelationSignal, but InteractiveContinuePrinter was missed. Apply the same cancellation signal pattern: - Add OnInterruptFunc field for custom interrupt handling - Replace internal.Exit(1) with cancel() - Defer exit() to ensure keyboard listener cleanup runs first Fixes pterm#758
MarvinJWendt
approved these changes
Apr 30, 2026
MarvinJWendt
left a comment
Member
There was a problem hiding this comment.
LGTM! Thanks for contributing 🚀
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.
Fixes #758
Problem
InteractiveContinuePrinter.Show()callsinternal.Exit(1)directly on Ctrl+C, which:stopListener()/con.Reset())resetto fixAll other interactive printers (
InteractiveSelectPrinter,InteractiveMultiselectPrinter,InteractiveTextInputPrinter) were fixed in #383 to useNewCancelationSignal, butInteractiveContinuePrinterwas missed.Fix
Apply the same cancellation signal pattern used by the other printers:
OnInterruptFuncfield for custom interrupt handling (consistent API)internal.Exit(1)withcancel()exit()to ensure keyboard listener cleanup runs before exitThis ensures the terminal is properly restored to cooked mode before the process exits.