Changeset 29a48d45f5b9…
Parent feb1ace7e724…
by
Changes to one file · Browse files at 29a48d45f5b9 Showing diff from parent feb1ace7e724 Diff from another changeset...
@@ -13,14 +13,30 @@ # Spawn background process and exit
if sys.platform[:3] == 'win':
if 'THG_HGTK_SPAWN' not in os.environ:
- env = os.environ
+ if hasattr(sys, "frozen"):
+ args = sys.argv
+ else:
+ args = [sys.executable] + sys.argv
+ args = ['"%s"' % arg for arg in args]
+ env = os.environ.copy()
env['THG_HGTK_SPAWN'] = '1'
- os.spawnve(os.P_NOWAIT, sys.executable, sys.argv, env)
+ os.spawnve(os.P_NOWAIT, sys.executable, args, env)
+ sys.exit(0)
else:
assert hasattr(os, 'fork')
if os.fork():
sys.exit(0)
+nofork = 'version help' # simple interactive commands should not fork
+for i, arg in enumerate(sys.argv):
+ if arg.startswith('hgtk') and len(sys.argv) >= i:
+ cmd = sys.argv[i+1]
+ break
+else:
+ cmd = None
+if cmd not in nofork.split() and 'HGTK_NOFORK' not in os.environ:
+ portable_fork()
+
if hasattr(sys, "frozen"):
# Prepend C:\Program Files\TortoiseHg\gtk (equiv) to the path
from thgutil import paths
|
Loading...