diff mercurial/util.py @ 27766:198f78a52a2f

util: adjust hgcmd() to handle frozen Mercurial on OS X Previously, 'hg serve -d' was trying to exec the bundled python executable, which failed with: Unknown option: -- usage: python [option] ... Try 'python -h'... abort: child process failed to start See the previous patch for details about the content of the various command variables. Note that unlike the previous patch here an application bundling Mercurial could set $HG in the environment to get the correct result, there isn't anything that a bundling application could do to get the correct result here. 'hg serve -d' now launches under TortoiseHg, and there is a process listed in the background, but a client process cannot connect to it for some reason, so more investigation is needed.
author Matt Harbison <matt_harbison@yahoo.com>
date Sun, 10 Jan 2016 18:15:39 -0500
parents f1fb93eebb1d
children 5ef99738a562
line wrap: on
line diff
--- a/mercurial/util.py	Sun Jan 10 17:56:08 2016 -0500
+++ b/mercurial/util.py	Sun Jan 10 18:15:39 2016 -0500
@@ -2044,7 +2044,11 @@
     get either the python call or current executable.
     """
     if mainfrozen():
-        return [sys.executable]
+        if getattr(sys, 'frozen', None) == 'macosx_app':
+            # Env variable set by py2app
+            return [os.environ['EXECUTABLEPATH']]
+        else:
+            return [sys.executable]
     return gethgcmd()
 
 def rundetached(args, condfn):