changeset 859:6390c377a9e6

Trap OSError when deleting env vars On the other OS, it seems that case insensitivity for environment vars can bite users when using some unknown combination of python 2.4.1 and win2kSP4+minsys (and probably other vversions of these softwares). The best way to avoid problems in those weird cases is to ignore OSError exception during env var deletion.
author Edouard Gomez <ed.gomez@free.fr>
date Tue, 09 Aug 2005 09:36:34 -0800
parents c333dfa8fa1a
children 6d6095823b82 c2e77581bc84 9a0af739cf55 16ce690c411d
files mercurial/hg.py
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hg.py	Mon Aug 08 19:49:48 2005 -0800
+++ b/mercurial/hg.py	Tue Aug 09 09:36:34 2005 -0800
@@ -1781,8 +1781,11 @@
         # Note: urllib2 takes proxy values from the environment and those will
         # take precedence
         for env in ["HTTP_PROXY", "http_proxy", "no_proxy"]:
-            if os.environ.has_key(env):
-                del os.environ[env]
+            try:
+                if os.environ.has_key(env):
+                    del os.environ[env]
+            except OSError:
+                pass
 
         proxy_handler = urllib2.BaseHandler()
         if host and not no_proxy: