diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2019-08-28 01:19:30 -0700 |
|---|---|---|
| committer | Carlton Gibson <carlton.gibson@noumenal.es> | 2019-08-28 10:19:30 +0200 |
| commit | a44d80f88e22eda24dacef48e368895ebea96635 (patch) | |
| tree | cc4e8315d0a6e0deb2755022138e24617bbb573c /django/utils/version.py | |
| parent | 1e6b9e29e64fc9f13d4680be141c64d24eb92cc9 (diff) | |
Adjusted subprocess.run() calls to use arg list, rather than string.
The Python docs recommend passing a sequence to subprocess.run() when
possible. Doing so allows for automatic escaping and quoting of
arguments.
https://docs.python.org/3/library/subprocess.html#frequently-used-arguments
> args is required for all calls and should be a string, or a sequence
> of program arguments. Providing a sequence of arguments is generally
> preferred, as it allows the module to take care of any required
> escaping and quoting of arguments (e.g. to permit spaces in file
> names).
Also removed `shell=True` where unnecessary.
Diffstat (limited to 'django/utils/version.py')
| -rw-r--r-- | django/utils/version.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/utils/version.py b/django/utils/version.py index a6f667d2b1..4b26586b36 100644 --- a/django/utils/version.py +++ b/django/utils/version.py @@ -78,7 +78,7 @@ def get_git_changeset(): """ repo_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) git_log = subprocess.run( - 'git log --pretty=format:%ct --quiet -1 HEAD', + ['git', 'log', '--pretty=format:%ct', '--quiet', '-1', 'HEAD'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, cwd=repo_dir, universal_newlines=True, ) |
