##// END OF EJS Templates
procutil: try and avoid angering CoreFoundation on macOS...
Augie Fackler -
r44749:a89381e0 default
parent child Browse files
Show More
@@ -423,7 +423,10 b' def system(cmd, environ=None, cwd=None, '
423 return rc
423 return rc
424
424
425
425
426 def gui():
426 _is_gui = None
427
428
429 def _gui():
427 '''Are we running in a GUI?'''
430 '''Are we running in a GUI?'''
428 if pycompat.isdarwin:
431 if pycompat.isdarwin:
429 if b'SSH_CONNECTION' in encoding.environ:
432 if b'SSH_CONNECTION' in encoding.environ:
@@ -439,6 +442,13 b' def gui():'
439 return pycompat.iswindows or encoding.environ.get(b"DISPLAY")
442 return pycompat.iswindows or encoding.environ.get(b"DISPLAY")
440
443
441
444
445 def gui():
446 global _is_gui
447 if _is_gui is None:
448 _is_gui = _gui()
449 return _is_gui
450
451
442 def hgcmd():
452 def hgcmd():
443 """Return the command used to execute current hg
453 """Return the command used to execute current hg
444
454
@@ -583,6 +593,11 b' else:'
583 `Subprocess.wait` function for the spawned process. This is mostly
593 `Subprocess.wait` function for the spawned process. This is mostly
584 useful for developers that need to make sure the spawned process
594 useful for developers that need to make sure the spawned process
585 finished before a certain point. (eg: writing test)'''
595 finished before a certain point. (eg: writing test)'''
596 if pycompat.isdarwin:
597 # avoid crash in CoreFoundation in case another thread
598 # calls gui() while we're calling fork().
599 gui()
600
586 # double-fork to completely detach from the parent process
601 # double-fork to completely detach from the parent process
587 # based on http://code.activestate.com/recipes/278731
602 # based on http://code.activestate.com/recipes/278731
588 if record_wait is None:
603 if record_wait is None:
General Comments 0
You need to be logged in to leave comments. Login now