summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorKonstantin Alekseev <mail@kalekseev.com>2021-04-26 15:19:13 +0300
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-04-27 10:43:35 +0200
commit6e742dabc95b00ba896434293556adeb4dbaee8a (patch)
tree4b55797fca1e697a3698e46291fe9f0751317205 /django
parent187118203197801c6cb72dc8b06b714b23b6dd3d (diff)
Fixed #32687 -- Restored passing process’ environment to underlying tool in dbshell on PostgreSQL.
Regression in bbe6fbb8768e8fb1aecb96d51c049d7ceaf802d3.
Diffstat (limited to 'django')
-rw-r--r--django/db/backends/base/client.py3
-rw-r--r--django/db/backends/postgresql/client.py2
2 files changed, 2 insertions, 3 deletions
diff --git a/django/db/backends/base/client.py b/django/db/backends/base/client.py
index 339f1e863c..8aca821fd2 100644
--- a/django/db/backends/base/client.py
+++ b/django/db/backends/base/client.py
@@ -21,6 +21,5 @@ class BaseDatabaseClient:
def runshell(self, parameters):
args, env = self.settings_to_cmd_args_env(self.connection.settings_dict, parameters)
- if env:
- env = {**os.environ, **env}
+ env = {**os.environ, **env} if env else None
subprocess.run(args, env=env, check=True)
diff --git a/django/db/backends/postgresql/client.py b/django/db/backends/postgresql/client.py
index 3effab65a8..0effcc44e6 100644
--- a/django/db/backends/postgresql/client.py
+++ b/django/db/backends/postgresql/client.py
@@ -51,7 +51,7 @@ class DatabaseClient(BaseDatabaseClient):
env['PGSSLKEY'] = str(sslkey)
if passfile:
env['PGPASSFILE'] = str(passfile)
- return args, env
+ return args, (env or None)
def runshell(self, parameters):
sigint_handler = signal.getsignal(signal.SIGINT)