Opened 9 years ago

Last modified 8 years ago

#26751 closed Cleanup/optimization

Make dbshell exit with the shell's error code — at Version 1

Reported by: Étienne BERSAC Owned by: nobody
Component: Core (Management commands) Version: dev
Severity: Normal Keywords: dbshell
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Tim Graham)

For scripting, commands should return a non zero exit-code on error. But dbshell seems to ignore the exit code. Here is how to reproduce:

(venv) $ echo 'auieaui;' | django-admin dbshell
ERROR:  syntax error at or near "auieaui"
LINE 1: auieaui;
        ^
(venv) $ echo $?
0

I suggested a fix in https://github.com/django/django/pull/6768 . @charettes asked me to open a ticket for discussion. Here your are :)

Regards,
Étienne

Change History (1)

comment:1 by Tim Graham, 9 years ago

Description: modified (diff)
Has patch: set
Patch needs improvement: set
Summary: dbshell error handlingMake dbshell exit with the shell's error code
Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

Is a similar fix applicable for the other database backends? Not sure if tests are feasible.

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