diff --git a/tools/utils/git_log.py b/tools/utils/git_log.py index 98c046aead7..f5bcd86b33d 100644 --- a/tools/utils/git_log.py +++ b/tools/utils/git_log.py @@ -55,11 +55,11 @@ class GitCommit: ) + args # print(" ".join(cmd)) - p = subprocess.Popen( + with subprocess.Popen( cmd, stdout=subprocess.PIPE, - ) - return p.stdout.read() + ) as p: + return p.stdout.read() @property def sha1_short(self): @@ -71,11 +71,11 @@ class GitCommit: "--short", self.sha1, ) - p = subprocess.Popen( + with subprocess.Popen( cmd, stdout=subprocess.PIPE, - ) - return p.stdout.read().strip().decode('ascii') + ) as p: + return p.stdout.read().strip().decode('ascii') @property def author(self):