diff options
| author | William Schwartz <wkschwartz@gmail.com> | 2020-11-09 14:42:53 -0600 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-11-10 08:16:53 +0100 |
| commit | cc2269350548307e3fe31723ff4e40a879a7a173 (patch) | |
| tree | d77d9c6411573bad8b7e09a5e55c3b6921867fcd /django | |
| parent | 0773837e15bb632afffb6848a58c59a791008fa1 (diff) | |
Fixed #32177 -- Made execute_from_command_line() use program name from the argv argument.
This caused crash in environments where sys.argv[0] is incorrectly set
to None.
Diffstat (limited to 'django')
| -rw-r--r-- | django/core/management/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py index 1ba093e51f..4e30a28f33 100644 --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -344,7 +344,12 @@ class ManagementUtility: # Preprocess options to extract --settings and --pythonpath. # These options could affect the commands that are available, so they # must be processed early. - parser = CommandParser(usage='%(prog)s subcommand [options] [args]', add_help=False, allow_abbrev=False) + parser = CommandParser( + prog=self.prog_name, + usage='%(prog)s subcommand [options] [args]', + add_help=False, + allow_abbrev=False, + ) parser.add_argument('--settings') parser.add_argument('--pythonpath') parser.add_argument('args', nargs='*') # catch-all |
