From 7cc2bf2f030940f0acd7b6ad0c56f2d60122fb34 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Sat, 21 Jul 2007 03:30:38 +0000 Subject: [PATCH] Fixed #4304 -- Modified sys.exit to os._exit to make sure development server quits when an error occurs attempting to bind to the requested port (e.g., if another server is already running). Thanks, Mario Gonzalez . git-svn-id: http://code.djangoproject.com/svn/django/trunk@5738 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- AUTHORS | 2 +- django/core/management.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 905cccc7ed..e1a18adf9d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -117,7 +117,7 @@ answer newbie questions, and generally made Django that much better: glin@seznam.cz martin.glueck@gmail.com GomoX - Mario Gonzalez + Mario Gonzalez Simon Greenhill Owen Griffiths Espen Grindhaug diff --git a/django/core/management.py b/django/core/management.py index 06a9a6857c..4c68417517 100644 --- a/django/core/management.py +++ b/django/core/management.py @@ -1236,7 +1236,8 @@ def runserver(addr, port, use_reloader=True, admin_media_dir=''): except (AttributeError, KeyError): error_text = str(e) sys.stderr.write(style.ERROR("Error: %s" % error_text) + '\n') - sys.exit(1) + # Need to use an OS exit because sys.exit doesn't work in a thread + os._exit(1) except KeyboardInterrupt: sys.exit(0) if use_reloader: