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

login
register
mail settings
Submitter phabricator
Date July 12, 2021, 4:01 a.m.
Message ID <differential-rev-PHID-DREV-o3h3kgdkfk4u7ntv2q2r-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49400/
State Superseded
Headers show

Comments

phabricator - July 12, 2021, 4:01 a.m.
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




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

Patch

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