diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-10-13 05:34:54 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2021-10-13 05:34:54 +0000 |
commit | b8d423e7d13686d6627571d6c4adf12661d82147 (patch) | |
tree | 11d64ff26fb53c3c01ee35d062ca0c51fb883550 /gitlint/shell.py | |
parent | Adding upstream version 0.15.1. (diff) | |
download | gitlint-7f9eae8e5939f911ce10870f5e2caaae6d546b7f.tar.xz gitlint-7f9eae8e5939f911ce10870f5e2caaae6d546b7f.zip |
Adding upstream version 0.16.0.upstream/0.16.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gitlint/shell.py')
-rw-r--r-- | gitlint/shell.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gitlint/shell.py b/gitlint/shell.py index 7f598ae..e05204a 100644 --- a/gitlint/shell.py +++ b/gitlint/shell.py @@ -11,8 +11,8 @@ from gitlint.utils import USE_SH_LIB, DEFAULT_ENCODING def shell(cmd): """ Convenience function that opens a given command in a shell. Does not use 'sh' library. """ - p = subprocess.Popen(cmd, shell=True) - p.communicate() + with subprocess.Popen(cmd, shell=True) as p: + p.communicate() if USE_SH_LIB: @@ -57,8 +57,8 @@ else: popen_kwargs['cwd'] = kwargs['_cwd'] try: - p = subprocess.Popen(args, **popen_kwargs) - result = p.communicate() + with subprocess.Popen(args, **popen_kwargs) as p: + result = p.communicate() except FileNotFoundError as e: raise CommandNotFound from e |