Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added support for raising KeyboardInterrupt #40

Merged
merged 1 commit into from
Mar 5, 2025

Conversation

fearphage
Copy link
Contributor

Background

fzf throws 130 to signal when it receives the SIGINT signal.

Change

This change converts that special exit code into raising a KeyboardInterrupt exception. This allows users to recover cleanly from SIGINT when using iterfzf. The below currently does not work, but it will after this PR.

try:
    result = iterfzf.iterfzf(...)
except KeyboardInterrupt:
    print('caught ctrl-c')

PS. I tried writing a test for this, but I ran into some issues.

Copy link
Owner

@dahlia dahlia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! Looks good to me.

@dahlia dahlia merged commit 87ed9ec into dahlia:main Mar 5, 2025
4 checks passed
dahlia added a commit that referenced this pull request Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants