summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-18 07:47:59 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-18 07:47:59 -0700
commit88b8b762722c1ec1ccc83d3f8a06e12fb5424139 (patch)
tree9d0cab8651d7e8baa8d5bf0c51c59bc7b3deef88
parent3b2bba3cba144c91873db51783accfffbb0e9af1 (diff)
downloadportage-88b8b762722c1ec1ccc83d3f8a06e12fb5424139.tar.gz
portage-88b8b762722c1ec1ccc83d3f8a06e12fb5424139.tar.bz2
portage-88b8b762722c1ec1ccc83d3f8a06e12fb5424139.zip
Fix ebuild-ipc.py to timeout if necessary when opening input_file
in blocking mode.
-rwxr-xr-xbin/ebuild-ipc.py10
1 files 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