Flush the read pipe after a process hangup is detected, before calling lostConnection.
authorRobert Collins <robertc@robertcollins.net>
Fri, 15 Jan 2010 08:23:32 +0000 (19:23 +1100)
committerRobert Collins <robertc@robertcollins.net>
Fri, 15 Jan 2010 08:23:32 +0000 (19:23 +1100)
filters/subunit2gtk

index c13cfc4d25aa55e88ed16be5d75691c2b79dc799..65835458fb361432f4f99a2c3566b8de2a1add2c 100755 (executable)
@@ -222,7 +222,7 @@ class GIOProtocolTestCase(object):
         self.protocol = TestProtocolServer(result)
         self.on_finish = on_finish
 
-    def read(self, source, condition):
+    def read(self, source, condition, all=True):
         #NB: \o/ actually blocks
         line = source.readline()
         if not line:
@@ -232,13 +232,17 @@ class GIOProtocolTestCase(object):
         self.protocol.lineReceived(line)
         # schedule more IO shortly - if we say we're willing to do it
         # immediately we starve things.
-        source_id = gobject.timeout_add(1, self.schedule_read)
-        return False
+       if not all:
+            source_id = gobject.timeout_add(1, self.schedule_read)
+            return False
+        else:
+            return True
 
     def schedule_read(self):
         self.read_id = gobject.io_add_watch(self.stream, gobject.IO_IN, self.read)
 
     def hup(self, source, condition):
+        while self.read(source, condition, all=True): pass
         self.protocol.lostConnection()
         gobject.source_remove(self.read_id)
         self.on_finish()