summaryrefslogtreecommitdiffstats
path: root/gitlint/shell.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-10-13 05:34:57 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-10-13 05:34:57 +0000
commite2d38cd54491535f409372393baeed787c77388d (patch)
treee9f823c384ee487d30de5ae84c8d3755f6974baa /gitlint/shell.py
parentReleasing debian version 0.15.1-3. (diff)
downloadgitlint-e2d38cd54491535f409372393baeed787c77388d.tar.xz
gitlint-e2d38cd54491535f409372393baeed787c77388d.zip
Merging upstream version 0.16.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gitlint/shell.py')
-rw-r--r--gitlint/shell.py8
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