#4785 Do not block when waiting for subprocess to finish
Merged by pingou. Opened by msrb.
msrb/pagure comm-and-wait  into  master

Download 4785.patch

If the subprocess generates enough output to fill up the pipe, it will
block and wait for somebody to read from the pipe before continuing.

Signed-off-by: Michal Srb michal@redhat.com

The problem is also described in the official docs: https://docs.python.org/3/library/subprocess.html#subprocess.Popen.wait

:thumbsup:

Thanks for catching this!

Looks like this is the change black would do:

diff --git a/ tests/test_pagure_lib_git.py b/ tests/test_pagure_lib_git.py
index 64ed6927c..3e67d42e4 100644
--- a/ tests/test_pagure_lib_git.py     
+++ b/ tests/test_pagure_lib_git.py     
@@ -3173,10 +3173,7 @@ index 0000000..60f7480
         here = os.path.dirname(os.path.realpath(__file__))
         # This should't block
         self.assertTrue(
-            pagure.lib.git.read_output(
-                ["git", "rev-list", "--all"],
-                here
-            )
+            pagure.lib.git.read_output(["git", "rev-list", "--all"], here)

Could you do it?
Otherwise, I can do it locally and push it via another PR to have CI run on it and close the two PR in one go.

Commit 6db5a5b9 fixes this pull-request

Pull-Request has been merged by pingou

Metadata