Handle platform.system() throwing an IOError

This can happen if the calling process is handling SIGCHLD.  See
http://bugs.python.org/issue9127

We ran into this in the zephyr_mirror.

(imported from commit 80fade2274714b7c2c4b9fe38c66a1db8cc63234)
This commit is contained in:
Zev Benjamin 2014-05-20 16:47:41 -07:00
parent 8829e654c1
commit 8694b14016

View file

@ -176,8 +176,15 @@ class Client(object):
self.client_name = client
def get_user_agent(self):
vendor = ''
vendor_version = ''
try:
vendor = platform.system()
vendor_version = platform.release()
except IOError:
# If the calling process is handling SIGCHLD, platform.system() can
# fail with an IOError. See http://bugs.python.org/issue9127
pass
if vendor == "Linux":
vendor, vendor_version, dummy = platform.linux_distribution()