diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-09-10 00:14:03 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-09-10 00:14:03 -0700 |
commit | 1d1a085e9f20b9d4c8e926bcc081b66d1ac0ffa9 (patch) | |
tree | 5911d9e001caa9f1e8f0646627e95ece6059cf7f | |
parent | ca0d02df899da78df1f2343a17ce9f340978b190 (diff) | |
download | portage-1d1a085e9f20b9d4c8e926bcc081b66d1ac0ffa9.tar.gz portage-1d1a085e9f20b9d4c8e926bcc081b66d1ac0ffa9.tar.bz2 portage-1d1a085e9f20b9d4c8e926bcc081b66d1ac0ffa9.zip |
Make ebuild-ipc.py handle exceptions from pickle.loads().
-rwxr-xr-x | bin/ebuild-ipc.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/bin/ebuild-ipc.py b/bin/ebuild-ipc.py index 5569a24b5..21e5647f3 100755 --- a/bin/ebuild-ipc.py +++ b/bin/ebuild-ipc.py @@ -94,23 +94,27 @@ class EbuildIpc(object): except IOError as e: portage.util.writemsg("%s\n" % (e,), noiselevel=-1) - if buf: + rval = 2 - reply = pickle.loads(buf.tostring()) - output_file.close() - input_file.close() + if buf: - (out, err, rval) = reply + try: + reply = pickle.loads(buf.tostring()) + except (EnvironmentError, EOFError, ValueError, + pickle.UnpicklingError) as e: + portage.util.writemsg("%s\n" % (e,), noiselevel=-1) - if out: - portage.util.writemsg_stdout(out, noiselevel=-1) + else: + output_file.close() + input_file.close() - if err: - portage.util.writemsg(err, noiselevel=-1) + (out, err, rval) = reply - else: + if out: + portage.util.writemsg_stdout(out, noiselevel=-1) - rval = 2 + if err: + portage.util.writemsg(err, noiselevel=-1) return rval |