Address ResourceWarning warnings

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
This commit is contained in:
JoeLametta
2019-08-12 09:00:00 +00:00
parent fff3014e15
commit bb4c25df97
11 changed files with 49 additions and 47 deletions

View File

@@ -317,11 +317,11 @@ class VersionGetter:
version = "(Unknown)"
try:
p = asyncsub.Popen(self._args,
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, close_fds=True)
p.wait()
output = asyncsub.recv_some(p, e=0, stderr=1).decode()
with asyncsub.Popen(self._args,
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, close_fds=True) as p:
p.wait()
output = asyncsub.recv_some(p, e=0, stderr=1).decode()
vre = self._regexp.search(output)
if vre:
version = self._expander % vre.groupdict()