#33715 closed Cleanup/optimization (fixed)

Prevent MySQL dbshell from exiting on Ctrl-C

Reported by: Andrew Roberts Owned by: Hasan Ramezani
Component: Core (Management commands) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Currently, pressing Ctrl-C in a MySQL dbshell will exit the program with a KeyboardInterrupt exception. In the mysql command line client, Ctrl-C will cancel the current command or clear the current command buffer if a command is not running. This is a similar issue to one that affected the PostgreSQL dbshell - see: #27954.

To fix this, we can override the SIGINT handler in the same way as for the PostgreSQL client. Or perhaps we can move this functionality from the django.db.backends.postgresql.client to the django.db.backends.base.client module, so that all db backends can benefit from Ctrl-C working as per the underlying db command line client.

Change History (3)

comment:1 Changed 16 months ago by Mariusz Felisiak

Triage Stage: UnreviewedAccepted
Version: 4.0dev

comment:2 Changed 16 months ago by Mariusz Felisiak

Has patch: set
Owner: changed from nobody to Hasan Ramezani
Status: newassigned

comment:3 Changed 16 months ago by GitHub <noreply@…>

Resolution: fixed
Status: assignedclosed

In 1a78ef2:

Fixed #33715 -- Allowed keyboard interrupt to abort queries in MySQL dbshell.

Note: See TracTickets for help on using tickets.
Back to Top