chiark / gitweb /
mdwsetup.py (progoutput): Only read one byte to decide whether there is more.
[mLib] / mdwsetup.py
index 06990a8cc1eaefdcad9a27effa27e8ca4941da41..0210714cbac542d91b5c525f14f851e23ecbbb89 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(1)
+  finally:
+    kid.stdout.close()
   if junk != '': raise ValueError \
     ("Child process `%s' produced unspected output %r" % (command, junk))
   rc = kid.wait()