#37109: Suppress KeyboardInterrupt traceback in dbshell
-------------------------------------+-------------------------------------
Reporter: | Owner: Vikashgraja
Vikashgraja |
Type: | Status: assigned
Cleanup/optimization |
Component: Core | Version: 6.0
(Management commands) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
When running `python manage.py dbshell` and exiting with Ctrl+C,
Django prints a full traceback originating from `subprocess.run()`.
This is reproducible with the SQLite backend on Python 3.13.
**Example:**
{{{
$ python manage.py dbshell
SQLite version 3.51.0
sqlite> [pressed Ctrl + C]
Traceback (most recent call last):
...
File ".../django/db/backends/base/client.py", line 31, in runshell
subprocess.run(args, env=env, check=True)
...
KeyboardInterrupt
}}}
**Expected behavior:**
`dbshell` should terminate cleanly without displaying a traceback
when interrupted with Ctrl+C, since this is normal interactive shell
behavior.
The issue appears to come from `subprocess.run()` propagating
KeyboardInterrupt during interactive shell execution.
A possible fix is to suppress KeyboardInterrupt around the
`subprocess.run()` call in:
django/db/backends/base/client.py
--
Ticket URL: <https://code.djangoproject.com/ticket/37109>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019e4124adc9-bc009710-59cb-47ef-a95c-4adeb1eb15f9-000000%40eu-central-1.amazonses.com.