Fix a deadlock in the signature tests. (#4772)
authorAlex Ozdemir <aozdemir@hmc.edu>
Mon, 20 Jul 2020 20:21:06 +0000 (13:21 -0700)
committerGitHub <noreply@github.com>
Mon, 20 Jul 2020 20:21:06 +0000 (13:21 -0700)
* wait() deadlocks if the OS pipe fills
* communicate() does not

This is essentially a duplicate of [this](https://github.com/CVC4/LFSC/pull/38).

test/signatures/run_test.py

index ac14267e939766da9d60e05eefe9ec32f7bb7a1e..df612e20a92d72c792fd9fb6c738c3813ad4af4c 100755 (executable)
@@ -111,12 +111,11 @@ def main():
     result = subprocess.Popen(cmd,
                               stderr=subprocess.STDOUT,
                               stdout=subprocess.PIPE)
-    code = result.wait()
-    if 0 != code:
-        stdout = result.stdout.read()
+    (stdout, _) = result.communicate()
+    if 0 != result.returncode:
         if stdout:
             print(stdout.decode())
-    return code
+    return result.returncode
 
 
 if __name__ == '__main__':