Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

hgtk: add function for portable forking

Not sure this works correctly on Windows in all cases, so not enabling yet.

Changeset 118563e3c69e

Parent 87b3a6cc0bf4

by Steve Borho

Changes to one file · Browse files at 118563e3c69e Showing diff from parent 87b3a6cc0bf4 Diff from another changeset...

Change 1 of 1 Show Entire File hgtk Stacked
 
9
10
11
 
 
 
 
 
 
 
 
 
 
 
 
12
13
14
 
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
@@ -9,6 +9,18 @@
 import os  import sys   +def portable_fork(): + # Spawn background process and exit + if sys.platform[:3] == 'win': + if 'THG_HGTK_SPAWN' not in os.environ: + env = os.environ + env['THG_HGTK_SPAWN'] = '1' + os.spawnve(os.P_NOWAIT, sys.executable, sys.argv, env) + else: + assert hasattr(os, 'fork') + if os.fork(): + sys.exit(0) +  if hasattr(sys, "frozen"):   # Prepend C:\Program Files\TortoiseHg\gtk (equiv) to the path   from thgutil import paths