ebuild-ipc: fix read timeout msg / daemon check
authorZac Medico <zmedico@gentoo.org>
Fri, 4 Jan 2013 07:34:05 +0000 (23:34 -0800)
committerZac Medico <zmedico@gentoo.org>
Fri, 4 Jan 2013 07:34:05 +0000 (23:34 -0800)
It got disabled in commit 06d31ef00da24352a6614f20bccfc892d2120ed9.

bin/ebuild-ipc.py

index ca707fa98ff777b38fae55909b6c86b6a0404f77..4046d8d256888f288ccb7d5f256ba39ad0335bab 100755 (executable)
@@ -145,12 +145,26 @@ class EbuildIpc(object):
 
        def _receive_reply(self, input_fd):
 
-               buf = None
+               start_time = time.time()
 
                pipe_reader = PipeReader(input_files={"input_fd":input_fd},
                        scheduler=global_event_loop())
                pipe_reader.start()
-               pipe_reader.wait()
+
+               eof = pipe_reader.poll() is not None
+
+               while not eof:
+                       pipe_reader._wait_loop(timeout=self._COMMUNICATE_RETRY_TIMEOUT_MS)
+                       eof = pipe_reader.poll() is not None
+                       if not eof:
+                               if self._daemon_is_alive():
+                                       self._timeout_retry_msg(start_time,
+                                               portage.localization._('during read'))
+                               else:
+                                       pipe_reader.cancel()
+                                       self._no_daemon_msg()
+                                       return 2
+
                buf = pipe_reader.getvalue() 
 
                retval = 2