From 8694b140168a5de8bb7f8529504d3237a175069e Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Tue, 20 May 2014 16:47:41 -0700 Subject: [PATCH] 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) --- zulip/__init__.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/zulip/__init__.py b/zulip/__init__.py index 8636296..b7b0626 100644 --- a/zulip/__init__.py +++ b/zulip/__init__.py @@ -176,8 +176,15 @@ class Client(object): self.client_name = client def get_user_agent(self): - vendor = platform.system() - vendor_version = platform.release() + 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()