From: Mark Wooding Date: Fri, 4 Oct 2019 15:10:50 +0000 (+0100) Subject: mdwsetup.py (progoutput): Explicitly close the `stdout' pipe. X-Git-Tag: 1.4.0~11 X-Git-Url: https://git.distorted.org.uk/~mdw/cfd/commitdiff_plain/f3c13bfa1db49e33489169ac92153e7a7d1c3110 mdwsetup.py (progoutput): Explicitly close the `stdout' pipe. --- diff --git a/mdwsetup.py b/mdwsetup.py index 06990a8..57832a2 100644 --- a/mdwsetup.py +++ b/mdwsetup.py @@ -74,8 +74,11 @@ def progoutput(command): status zero. """ kid = SUB.Popen(command, stdout = SUB.PIPE) - out = kid.stdout.readline() - junk = kid.stdout.read() + try: + out = kid.stdout.readline() + junk = kid.stdout.read() + finally: + kid.stdout.close() if junk != '': raise ValueError \ ("Child process `%s' produced unspected output %r" % (command, junk)) rc = kid.wait()