diff --git a/django/db/backends/postgresql_psycopg2/client.py b/django/db/backends/postgresql_psycopg2/client.py
index 23ac9f2..3b17b3e 100644
a
|
b
|
class DatabaseClient(BaseDatabaseClient):
|
17 | 17 | if settings_dict['PORT']: |
18 | 18 | args.extend(["-p", str(settings_dict['PORT'])]) |
19 | 19 | args += [settings_dict['NAME']] |
20 | | if os.name == 'nt': |
21 | | sys.exit(os.system(" ".join(args))) |
22 | | else: |
23 | | os.execvp(self.executable_name, args) |
| 20 | env = os.environ.copy() |
| 21 | if settings_dict['PASSWORD']: |
| 22 | env['PGPASSWORD'] = settings_dict['PASSWORD'] |
| 23 | os.execvpe(self.executable_name, args, env) |