[libgxps] regtest: read stderr output before calling wait to fix a possible deadlock



commit b16bacce3667252586231adc1935441b3543e7b5
Author: Thomas Freitag <thomas freitag kabelmail de>
Date:   Sat Jan 7 11:55:41 2012 +0100

    regtest: read stderr output before calling wait to fix a possible deadlock
    
    In the way the scripts starts it subprocesses, stderr becomes buffered
    for the subprocesses. And unforunately, when the buffer limit is
    reached, the subprocess suspends it work until it can print again on
    stderr. That's why the python script runs into a deadlock when the
    subprocess produces a lot of error messages. A small rearrange of the
    commands, first read the stderr output and then wait that the subprocess

 regtest/Test.py |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/regtest/Test.py b/regtest/Test.py
index 71785f5..76078e3 100644
--- a/regtest/Test.py
+++ b/regtest/Test.py
@@ -154,9 +154,9 @@ class Test:
         return True
 
     def _check_exit_status(self, p, out_path):
+        stderr = p.stderr.read()
         status = p.wait()
 
-        stderr = p.stderr.read()
         self.__create_stderr_file(stderr, out_path)
 
         if not os.WIFEXITED(status):
@@ -169,11 +169,11 @@ class Test:
         return True
 
     def _check_exit_status2(self, p1, p2, out_path):
+        p1_stderr = p1.stderr.read()
         status1 = p1.wait()
+        p2_stderr = p2.stderr.read()
         status2 = p2.wait()
 
-        p1_stderr = p1.stderr.read()
-        p2_stderr = p2.stderr.read()
         if p1_stderr or p2_stderr:
             self.__create_stderr_file(p1_stderr + p2_stderr, out_path)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]