[Updated] D9152: hook: ignore EPIPE when flushing stdout/stderr
mplamann (Mitchell Plamann)
phabricator at mercurial-scm.org
Fri Oct 16 07:49:07 UTC 2020
Closed by commit rHGb3e8d8e4a40d: hook: ignore EPIPE when flushing stdout/stderr (authored by mplamann).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D9152?vs=23207&id=23247
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D9152/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D9152
AFFECTED FILES
mercurial/hook.py
tests/test-transaction-rollback-on-sigpipe.t
CHANGE DETAILS
diff --git a/tests/test-transaction-rollback-on-sigpipe.t b/tests/test-transaction-rollback-on-sigpipe.t
--- a/tests/test-transaction-rollback-on-sigpipe.t
+++ b/tests/test-transaction-rollback-on-sigpipe.t
@@ -64,4 +64,4 @@
abort: stream ended unexpectedly (got 0 bytes, expected 4)
$ check_for_abandoned_transaction
- Abandoned transaction!
+ [1]
diff --git a/mercurial/hook.py b/mercurial/hook.py
--- a/mercurial/hook.py
+++ b/mercurial/hook.py
@@ -8,6 +8,7 @@
from __future__ import absolute_import
import contextlib
+import errno
import os
import sys
@@ -289,10 +290,18 @@
# The stderr is fully buffered on Windows when connected to a pipe.
# A forcible flush is required to make small stderr data in the
# remote side available to the client immediately.
- procutil.stderr.flush()
+ try:
+ procutil.stderr.flush()
+ except IOError as err:
+ if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
+ raise error.StdioError(err)
if _redirect and oldstdout >= 0:
- procutil.stdout.flush() # write hook output to stderr fd
+ try:
+ procutil.stdout.flush() # write hook output to stderr fd
+ except IOError as err:
+ if err.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
+ raise error.StdioError(err)
os.dup2(oldstdout, stdoutno)
os.close(oldstdout)
To: mplamann, #hg-reviewers, pulkit
Cc: pulkit, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20201016/329ee4cd/attachment-0002.html>
More information about the Mercurial-patches
mailing list