src/mercurialserver/config.py
changeset 217 32b431977bf9
parent 216 0122df83ebd0
child 225 ff08fd5b1a62
--- a/src/mercurialserver/config.py	Fri Nov 13 14:58:55 2009 +0000
+++ b/src/mercurialserver/config.py	Fri Nov 13 16:39:34 2009 +0000
@@ -1,7 +1,9 @@
 # Copyright 2008-2009 LShift Ltd
 
 import sys
+import os
 import os.path
+import pwd
 import ConfigParser
 
 globalconfig = None
@@ -36,9 +38,11 @@
 def getEnv(): return _getConf().items("env")
 
 # Work out where we are, don't use config.
-def setExePath():
+def initExe():
     global _exePath
     _exePath = os.path.dirname(os.path.abspath(sys.argv[0]))
+    # Fix $HOME in case of "sudo -u hg refresh-auth"
+    os.environ['HOME'] = pwd.getpwuid(os.geteuid()).pw_dir
 
 def getExePath():
     return _exePath