Skip to content

More information and care on KeyboardInterrupt #1239

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rolandwalker
Copy link
Contributor

@rolandwalker rolandwalker commented Jun 7, 2025

Description

mycli is already much better at cancelling queries on KeyboardInterrupt, compared to the vendor client. But not perfect -- and sometimes the result is an unfortunate runaway query.

Here we:

  • catch the case that "ok" is not in the status string, and emit a warning in red. Previously we only caught Exceptions.
  • add an echo to the debugged path in which cancellation is skipped.
  • downgrade the routine cancellation message to blue and add the query id number.

The first and second changes are intended to help the user notice the cases in which we fail to interrupt, and know that we failed. The third change is intended to help in unknown cases, in which we believe that we succeeded, but didn't actually interrupt.

example_query_cancel

Checklist

  • I've added this contribution to the changelog.md.
  • I've added my name to the AUTHORS file (or it's already there).

@rolandwalker rolandwalker requested a review from amjith June 7, 2025 12:35
@rolandwalker rolandwalker self-assigned this Jun 7, 2025
mycli is already _much_ better at cancelling queries on
KeyboardInterrupt, compared to the vendor client.  But not perfect --
and sometimes the result is an unfortunate runaway query.

Here we:
 * catch the case that "ok" is not in the status string, and emit a
   warning in red.  Previously we only caught Exceptions.
 * add an echo to the debugged path in which cancellation is skipped.
 * downgrade the routine cancellation message to blue and add the query
   id number.

The first and second changes are intended to help the user notice the
cases in which we fail to interrupt, and know that we failed.  The
third change is intended to help in unknown cases, in which we believe
that we succeeded, but didn't interrupt.
@rolandwalker rolandwalker force-pushed the RW/more-informative-query-cancel-keyboard-interrupt branch from a84c728 to aa46615 Compare June 7, 2025 12:39
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.

1 participant