Avoid ResourceWarning messages: close stdout

This commit is contained in:
ZyX 2013-03-17 14:01:10 +04:00
parent 84dfac6f8e
commit 050a34bceb

View File

@ -97,6 +97,7 @@ except ImportError:
def readlines(cmd, cwd): def readlines(cmd, cwd):
p = Popen(cmd, shell=False, stdout=PIPE, stderr=PIPE, cwd=cwd) p = Popen(cmd, shell=False, stdout=PIPE, stderr=PIPE, cwd=cwd)
p.stderr.close() p.stderr.close()
with p.stdout:
for line in p.stdout: for line in p.stdout:
yield line[:-1].decode('utf-8') yield line[:-1].decode('utf-8')