hgdemandimport/tracing.py
changeset 39397 452790284a15
parent 39254 284440041141
child 42476 d0b8a3cfd732
equal deleted inserted replaced
39396:f57682dca1c1 39397:452790284a15
    26             return
    26             return
    27         _pipe = open(os.environ['HGCATAPULTSERVERPIPE'], 'w', 1)
    27         _pipe = open(os.environ['HGCATAPULTSERVERPIPE'], 'w', 1)
    28         _session = os.environ.get('HGCATAPULTSESSION', 'none')
    28         _session = os.environ.get('HGCATAPULTSESSION', 'none')
    29     whence = whencefmt % whenceargs
    29     whence = whencefmt % whenceargs
    30     try:
    30     try:
    31         _pipe.write('START %s %s\n' % (_session, whence))
    31         # Both writes to the pipe are wrapped in try/except to ignore
       
    32         # errors, as we can see mysterious errors in here if the pager
       
    33         # is active. Presumably other conditions could trigger
       
    34         # problems too.
       
    35         try:
       
    36             _pipe.write('START %s %s\n' % (_session, whence))
       
    37         except IOError:
       
    38             pass
    32         yield
    39         yield
    33     finally:
    40     finally:
    34         _pipe.write('END %s %s\n' % (_session, whence))
    41         try:
       
    42             _pipe.write('END %s %s\n' % (_session, whence))
       
    43         except IOError:
       
    44             pass