D11086: sigpipe-remote: verify the script is IO are unbuffered

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Jul 12 04:01:00 UTC 2021


marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  We don't want to get stuck anywhere by buffers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11086

AFFECTED FILES
  tests/testlib/sigpipe-remote.py

CHANGE DETAILS

diff --git a/tests/testlib/sigpipe-remote.py b/tests/testlib/sigpipe-remote.py
--- a/tests/testlib/sigpipe-remote.py
+++ b/tests/testlib/sigpipe-remote.py
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 from __future__ import print_function
 
+import io
 import os
 import subprocess
 import sys
@@ -16,6 +17,10 @@
     print('SIGPIPE-HELPER:   %s is running %s' % (exe, ver), file=sys.stderr)
     sys.exit(255)
 
+if isinstance(sys.stdout.buffer, io.BufferedWriter):
+    print('SIGPIPE-HELPER: script need unbuffered output', file=sys.stderr)
+    sys.exit(255)
+
 DEBUG_FILE = os.environ.get('SIGPIPE_REMOTE_DEBUG_FILE')
 if DEBUG_FILE is None:
     debug_stream = sys.stderr.buffer



To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel


More information about the Mercurial-devel mailing list