Repository navigation
fix: make sure the interactive printers can cleanup after Ctrl+C - #383
Merged
MarvinJWendt merged 2 commits intoJul 26, 2022
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## master #383 +/- ##
==========================================
- Coverage 81.90% 81.78% -0.12%
==========================================
Files 28 28
Lines 2006 2015 +9
==========================================
+ Hits 1643 1648 +5
- Misses 349 355 +6
+ Partials 14 12 -2
Continue to review full report at Codecov.
|
jochil
force-pushed
the
jochil/cleanup-after-cancelation
branch
from
July 25, 2022 14:27
07dbed1 to
f359cb3
Compare
After canceling the interactive printers with Ctrl+C, `os.Exit` was directly called in the keyboard listener. Because of this the `defer` statements of the surrounding function were not called (for example `cursor.Show`) and the keyboard listener was still running. This resulted in a broken user "terminal" (no Cursor, no Ctrl+C)
jochil
force-pushed
the
jochil/cleanup-after-cancelation
branch
from
July 25, 2022 14:36
f359cb3 to
be55629
Compare
jochil
marked this pull request as ready for review
July 25, 2022 14:37
MarvinJWendt
approved these changes
Jul 26, 2022
MarvinJWendt
left a comment
Member
There was a problem hiding this comment.
LGTM! Thanks for contributing 🥳
This PR should be released in the next 12h. If not, feel free to ping me :)
MarvinJWendt
enabled auto-merge
July 26, 2022 09:26
Yanhu007
added a commit
to Yanhu007/pterm
that referenced
this pull request
Apr 12, 2026
… 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
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.
Description
After canceling the interactive printers with Ctrl+C,
os.Exitwasdirectly called in the keyboard listener. Because of this the
deferstatements of the surrounding function were not called(for example
cursor.Show) and the keyboard listenerwas still running.
This resulted in a broken user "terminal" (no Cursor, no Ctrl+C)
Scope
Related Issue
none
To-Do Checklist