diff options
| author | Claude Paroz <claude@2xlibre.net> | 2019-08-23 10:53:36 +0200 |
|---|---|---|
| committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2019-08-23 10:53:36 +0200 |
| commit | 9386586f31b8a0bccf59a1bff647cd829d4e79aa (patch) | |
| tree | f28bf4c9b8b0a1431c1b6722f9d5bb613d78040f /django/core/management/utils.py | |
| parent | 7bd963332017eace00be8caf7dc1b7b304da613a (diff) | |
Replaced subprocess commands by run() wherever possible.
Diffstat (limited to 'django/core/management/utils.py')
| -rw-r--r-- | django/core/management/utils.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/django/core/management/utils.py b/django/core/management/utils.py index c201684c9c..43addf8bdd 100644 --- a/django/core/management/utils.py +++ b/django/core/management/utils.py @@ -1,7 +1,7 @@ import fnmatch import os from pathlib import Path -from subprocess import PIPE, Popen +from subprocess import PIPE, run from django.apps import apps as installed_apps from django.utils.crypto import get_random_string @@ -17,13 +17,12 @@ def popen_wrapper(args, stdout_encoding='utf-8'): Return stdout output, stderr output, and OS status code. """ try: - p = Popen(args, shell=False, stdout=PIPE, stderr=PIPE, close_fds=os.name != 'nt') + p = run(args, stdout=PIPE, stderr=PIPE, close_fds=os.name != 'nt') except OSError as err: raise CommandError('Error executing %s' % args[0]) from err - output, errors = p.communicate() return ( - output.decode(stdout_encoding), - errors.decode(DEFAULT_LOCALE_ENCODING, errors='replace'), + p.stdout.decode(stdout_encoding), + p.stderr.decode(DEFAULT_LOCALE_ENCODING, errors='replace'), p.returncode ) |
