comparison mercurial/dispatch.py @ 10952:6c2c766afefe stable

dispatch: ignore if signals can not be set This happens if the code is executed in a thread. This patch allows tortoisehg to start the inotify server again.
author Simon Heimberg <simohe@besonet.ch>
date Wed, 07 Apr 2010 02:41:22 +0200
parents 16df09a54113
children 8d5f5122a732 59d0d715fbfa
comparison
equal deleted inserted replaced
10951:5dc09507b90e 10952:6c2c766afefe
31 31
32 def _runcatch(ui, args): 32 def _runcatch(ui, args):
33 def catchterm(*args): 33 def catchterm(*args):
34 raise error.SignalInterrupt 34 raise error.SignalInterrupt
35 35
36 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': 36 try:
37 num = getattr(signal, name, None) 37 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM':
38 if num: 38 num = getattr(signal, name, None)
39 signal.signal(num, catchterm) 39 if num:
40 signal.signal(num, catchterm)
41 except ValueError:
42 pass # happens if called in a thread
40 43
41 try: 44 try:
42 try: 45 try:
43 # enter the debugger before command execution 46 # enter the debugger before command execution
44 if '--debugger' in args: 47 if '--debugger' in args: