From 88b8b762722c1ec1ccc83d3f8a06e12fb5424139 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 18 Sep 2010 07:47:59 -0700 Subject: Fix ebuild-ipc.py to timeout if necessary when opening input_file in blocking mode. --- bin/ebuild-ipc.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/bin/ebuild-ipc.py b/bin/ebuild-ipc.py index 7637fb5d5..6f17f737b 100755 --- a/bin/ebuild-ipc.py +++ b/bin/ebuild-ipc.py @@ -120,7 +120,7 @@ class EbuildIpc(object): self._no_daemon_msg() return 2 - input_file = open(self.ipc_out_fifo, 'rb', 0) + input_file = None start_time = time.time() while True: @@ -128,6 +128,10 @@ class EbuildIpc(object): try: portage.exception.AlarmSignal.register( self._COMMUNICATE_RETRY_TIMEOUT_SECONDS) + + if input_file is None: + input_file = open(self.ipc_out_fifo, 'rb', 0) + # Read the whole pickle in a single atomic read() call. buf = array.array('B') try: @@ -148,6 +152,9 @@ class EbuildIpc(object): self._no_daemon_msg() return 2 + if input_file is not None: + input_file.close() + rval = 2 if buf: @@ -161,7 +168,6 @@ class EbuildIpc(object): level=logging.ERROR, noiselevel=-1) else: - input_file.close() (out, err, rval) = reply -- cgit v1.2.3-1-g7c22