changeset 47617:d5fc1b59a2df

sigpipe-remote: verify the script is IO are unbuffered We don't want to get stuck anywhere by buffers. Differential Revision: https://phab.mercurial-scm.org/D11086
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 12 Jul 2021 03:29:21 +0200
parents df6148ca7120
children 27ff81547d35
files tests/testlib/sigpipe-remote.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/testlib/sigpipe-remote.py	Sun Jul 11 23:08:00 2021 +0200
+++ b/tests/testlib/sigpipe-remote.py	Mon Jul 12 03:29:21 2021 +0200
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 from __future__ import print_function
 
+import io
 import os
 import subprocess
 import sys
@@ -9,6 +10,10 @@
 
 # we cannot use mercurial.testing as long as python2 is not dropped as the test will only install the mercurial module for python2 in python2 run
 
+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