Skip to content
Snippets Groups Projects
Commit 452790284a15 authored by Augie Fackler's avatar Augie Fackler
Browse files

tracing: ignore any IOErrors when writing to pipe

When the pager forks off the main process, we can end up with the pipe
closed prematurely. Rather than break hg entirely when that happens
and tracing is active, just let lingering events disappear as needed.

Differential Revision: https://phab.mercurial-scm.org/D4445
parent f57682dca1c1
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,13 @@
_session = os.environ.get('HGCATAPULTSESSION', 'none')
whence = whencefmt % whenceargs
try:
_pipe.write('START %s %s\n' % (_session, whence))
# Both writes to the pipe are wrapped in try/except to ignore
# errors, as we can see mysterious errors in here if the pager
# is active. Presumably other conditions could trigger
# problems too.
try:
_pipe.write('START %s %s\n' % (_session, whence))
except IOError:
pass
yield
finally:
......@@ -32,3 +39,6 @@
yield
finally:
_pipe.write('END %s %s\n' % (_session, whence))
try:
_pipe.write('END %s %s\n' % (_session, whence))
except IOError:
pass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment