diff options
author | Mikhail Borisov <borisov.mikhail@gmail.com> | 2022-02-10 16:45:40 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:40 +0300 |
commit | 5d50718e66d9c037dc587a0211110b7d25a66185 (patch) | |
tree | e98df59de24d2ef7c77baed9f41e4875a2fef972 /library/python/testing | |
parent | a6a92afe03e02795227d2641b49819b687f088f8 (diff) | |
download | ydb-5d50718e66d9c037dc587a0211110b7d25a66185.tar.gz |
Restoring authorship annotation for Mikhail Borisov <borisov.mikhail@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/python/testing')
-rw-r--r-- | library/python/testing/yatest_common/yatest/common/process.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/library/python/testing/yatest_common/yatest/common/process.py b/library/python/testing/yatest_common/yatest/common/process.py index d252538d13..a8bcc21f51 100644 --- a/library/python/testing/yatest_common/yatest/common/process.py +++ b/library/python/testing/yatest_common/yatest/common/process.py @@ -468,23 +468,23 @@ def execute( # if subprocess.PIPE in [stdout, stderr]: # raise ValueError("Don't use pipe to obtain stream data - it may leads to the deadlock") - def get_out_stream(stream, default_name): - if stream is None: - # No stream is supplied: open new temp file + def get_out_stream(stream, default_name): + if stream is None: + # No stream is supplied: open new temp file return _get_command_output_file(command, default_name), False - + if isinstance(stream, six.string_types): - # User filename is supplied: open file for writing + # User filename is supplied: open file for writing return open(stream, 'wb+'), stream.startswith('/dev/') - - # Open file or PIPE sentinel is supplied - is_pipe = stream == subprocess.PIPE - return stream, not is_pipe - + + # Open file or PIPE sentinel is supplied + is_pipe = stream == subprocess.PIPE + return stream, not is_pipe + # to be able to have stdout/stderr and track the process time execution, we don't use subprocess.PIPE, # as it can cause processes hangs, but use tempfiles instead - out_file, user_stdout = get_out_stream(stdout, 'out') - err_file, user_stderr = get_out_stream(stderr, 'err') + out_file, user_stdout = get_out_stream(stdout, 'out') + err_file, user_stderr = get_out_stream(stderr, 'err') in_file = stdin if shell and type(command) == list: |