From 430b8c8ff5fc9f180f3f7ddf5fe573e95ed615ef Mon Sep 17 00:00:00 2001
From: Andreas Schenk <andreas_schenk@hms.harvard.edu>
Date: Wed, 1 Aug 2012 16:28:43 -0400
Subject: [PATCH] added workaround for interrupted system calls during startup

---
 modules/base/pymod/settings.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/modules/base/pymod/settings.py b/modules/base/pymod/settings.py
index 56bf46b4a..34afdc0b2 100644
--- a/modules/base/pymod/settings.py
+++ b/modules/base/pymod/settings.py
@@ -1,6 +1,18 @@
 import os, platform
 import __main__
  
+def GetPlatform():
+  """
+  Returns platform.system(). If the system call is interrupted, it is repeated.
+  This function is a workaround for the buggy system call handling in Python.
+  """
+  system=None
+  while not system:
+    try:
+      system=platform.system()
+    except IOError:
+      pass
+  return system
 
 def GetValue(val_key,val_default=None,prefix='OST'):
   """
@@ -89,7 +101,7 @@ def Locate(file_name, explicit_file_name=None, search_paths=[],
 
   if search_system_paths:
     paths=os.getenv('PATH')
-    if platform.system() == "Windows":
+    if GetPlatform() == "Windows":
       searched+=paths.split(';')
     else:
       searched+=paths.split(':')
-- 
GitLab