mdwsetup.py (progoutput): Explicitly close the `stdout' pipe.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 4 Oct 2019 15:10:50 +0000 (16:10 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 8 May 2020 11:30:13 +0000 (12:30 +0100)
mdwsetup.py

index 06990a8..57832a2 100644 (file)
@@ -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()