Mercurial > public > mercurial-scm > hg
comparison tests/testlib/sigpipe-remote.py @ 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 |
comparison
equal
deleted
inserted
replaced
47616:df6148ca7120 | 47617:d5fc1b59a2df |
---|---|
1 #!/usr/bin/env python3 | 1 #!/usr/bin/env python3 |
2 from __future__ import print_function | 2 from __future__ import print_function |
3 | 3 |
4 import io | |
4 import os | 5 import os |
5 import subprocess | 6 import subprocess |
6 import sys | 7 import sys |
7 import threading | 8 import threading |
8 import time | 9 import time |
9 | 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 | 11 # 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 |
12 | |
13 if isinstance(sys.stdout.buffer, io.BufferedWriter): | |
14 print('SIGPIPE-HELPER: script need unbuffered output', file=sys.stderr) | |
15 sys.exit(255) | |
11 | 16 |
12 DEBUG_FILE = os.environ.get('SIGPIPE_REMOTE_DEBUG_FILE') | 17 DEBUG_FILE = os.environ.get('SIGPIPE_REMOTE_DEBUG_FILE') |
13 if DEBUG_FILE is None: | 18 if DEBUG_FILE is None: |
14 debug_stream = sys.stderr.buffer | 19 debug_stream = sys.stderr.buffer |
15 else: | 20 else: |