34 |
34 |
35 from __future__ import absolute_import |
35 from __future__ import absolute_import |
36 |
36 |
37 import itertools |
37 import itertools |
38 import os |
38 import os |
39 import platform |
|
40 import subprocess |
39 import subprocess |
41 import sys |
40 import sys |
42 |
41 |
43 from mercurial import encoding |
42 from mercurial import ( |
|
43 encoding, |
|
44 pycompat, |
|
45 ) |
44 |
46 |
45 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
47 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for |
46 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
48 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should |
47 # be specifying the version(s) of Mercurial they are tested with, or |
49 # be specifying the version(s) of Mercurial they are tested with, or |
48 # leave the attribute unspecified. |
50 # leave the attribute unspecified. |
49 testedwith = 'ships-with-hg-core' |
51 testedwith = 'ships-with-hg-core' |
50 |
52 |
51 def uisetup(ui): |
53 def uisetup(ui): |
52 if platform.system() == 'Windows': |
54 if pycompat.osname == 'nt': |
53 # no fork on Windows, but we can create a detached process |
55 # no fork on Windows, but we can create a detached process |
54 # https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863.aspx |
56 # https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863.aspx |
55 # No stdlib constant exists for this value |
57 # No stdlib constant exists for this value |
56 DETACHED_PROCESS = 0x00000008 |
58 DETACHED_PROCESS = 0x00000008 |
57 _creationflags = DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP |
59 _creationflags = DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP |