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

feat(SIGINT): better handle interrupts #1255

Merged
merged 2 commits into from
Dec 2, 2024
Merged

feat(SIGINT): better handle interrupts #1255

merged 2 commits into from
Dec 2, 2024

Conversation

caarlos0
Copy link
Member

@caarlos0 caarlos0 commented Nov 27, 2024

This PR introduces Interrupt(), InterruptMsg{}, and ErrInterrupted.

Users can still handle "ctrl+c" as before, but instead of return tea.Quit, they can return tea.Interrupt.

Later on, they can check if errors.Is(err, tea.ErrInterrupted), and os.Exit(130) if they want to exit with a different code.

This PR introduces `Interrupt()`, `InterruptMsg{}`, and
`ErrInterrupted`.

Users can still handle "ctrl+c" as before, but instead of return
`tea.Quit`, they can return `tea.Interrupt`.

Later on, they can `errors.If(err, tea.ErrInterrupted)` and
`os.Exit(130)` if they want to.
@caarlos0 caarlos0 added the enhancement New feature or request label Nov 27, 2024
@caarlos0 caarlos0 self-assigned this Nov 27, 2024
it was bothering me
@caarlos0 caarlos0 merged commit cb93959 into main Dec 2, 2024
44 checks passed
@caarlos0 caarlos0 deleted the sigint branch December 2, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants