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:
parent
8829e654c1
commit
8694b14016
|
@ -176,8 +176,15 @@ class Client(object):
|
||||||
self.client_name = client
|
self.client_name = client
|
||||||
|
|
||||||
def get_user_agent(self):
|
def get_user_agent(self):
|
||||||
|
vendor = ''
|
||||||
|
vendor_version = ''
|
||||||
|
try:
|
||||||
vendor = platform.system()
|
vendor = platform.system()
|
||||||
vendor_version = platform.release()
|
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":
|
if vendor == "Linux":
|
||||||
vendor, vendor_version, dummy = platform.linux_distribution()
|
vendor, vendor_version, dummy = platform.linux_distribution()
|
||||||
|
|
Loading…
Reference in a new issue