diff options
author | zhukoff-pavel <zhukoff-pavel@yandex-team.com> | 2023-11-02 14:14:46 +0300 |
---|---|---|
committer | zhukoff-pavel <zhukoff-pavel@yandex-team.com> | 2023-11-02 14:48:37 +0300 |
commit | 6b1b27b6628a6b31edeea3cfef040413ac973895 (patch) | |
tree | abd807ac0b45401b6f085599708825f0a49bc672 /library/python | |
parent | ddd7b74c610291ab16eeaab1ebca939e2b7d8c43 (diff) | |
download | ydb-6b1b27b6628a6b31edeea3cfef040413ac973895.tar.gz |
Diffstat (limited to 'library/python')
-rw-r--r-- | library/python/testing/yatest_common/yatest/common/process.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/library/python/testing/yatest_common/yatest/common/process.py b/library/python/testing/yatest_common/yatest/common/process.py index e84f2abc08..2b6ae26c53 100644 --- a/library/python/testing/yatest_common/yatest/common/process.py +++ b/library/python/testing/yatest_common/yatest/common/process.py @@ -548,14 +548,18 @@ def execute( def get_out_stream(stream, default_name): mode = 'w+t' if text else 'w+b' - open_kwargs = {'errors': 'ignore', 'encoding': 'utf-8'} if text else {} + open_kwargs = {'errors': 'ignore', 'encoding': 'utf-8'} if text else {'buffering': 0} if stream is None: # No stream is supplied: open new temp file return _get_command_output_file(command, default_name, mode, open_kwargs), False if isinstance(stream, six.string_types): + is_block = stream.startswith('/dev/') + if is_block: + mode = 'w+b' + open_kwargs = {'buffering': 0} # User filename is supplied: open file for writing - return io.open(stream, mode, **open_kwargs), stream.startswith('/dev/') + return io.open(stream, mode, **open_kwargs), is_block # Open file or PIPE sentinel is supplied is_pipe = stream == subprocess.PIPE |