diff options
author | ilyasiluyanov <ilyasiluyanov@yandex-team.com> | 2023-06-08 12:09:10 +0300 |
---|---|---|
committer | ilyasiluyanov <ilyasiluyanov@yandex-team.com> | 2023-06-08 12:09:10 +0300 |
commit | 10437a7b9014ec516b48034ea8ace7d08f806407 (patch) | |
tree | e3da086230a38e37d59a869d2bbc125648d9b27c | |
parent | 0a97f207855774dc00c57e2dc12147751705d509 (diff) | |
download | ydb-10437a7b9014ec516b48034ea8ace7d08f806407.tar.gz |
Fix filemode on stdout open
Set binary mode as default, use `str` (aka unicode) on demand
-rw-r--r-- | library/python/testing/yatest_common/yatest/common/process.py | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/library/python/testing/yatest_common/yatest/common/process.py b/library/python/testing/yatest_common/yatest/common/process.py index 64edee98b5a..9ecaed7725a 100644 --- a/library/python/testing/yatest_common/yatest/common/process.py +++ b/library/python/testing/yatest_common/yatest/common/process.py @@ -481,7 +481,7 @@ def execute( stdin=None, stdout=None, stderr=None, - text=None, + text=False, creationflags=0, wait=True, process_progress_listener=None, @@ -506,7 +506,7 @@ def execute( :param stdout: command stdout :param stderr: command stderr :param text: 'subprocess.Popen'-specific argument, specifies the type of returned data https://docs.python.org/3/library/subprocess.html#subprocess.run - :type text: bool, optional (only for backward compatibility, do not use it!) + :type text: bool :param creationflags: command creation flags :param wait: should wait until the command finishes :param process_progress_listener=object that is polled while execution is in progress @@ -541,13 +541,6 @@ def execute( if popen_kwargs is None: popen_kwargs = {} - if 'text' not in popen_kwargs and six.PY3: - # Return str for python3 if it not setted - popen_kwargs['text'] = True - - if text and six.PY3: - popen_kwargs['text'] = True - # if subprocess.PIPE in [stdout, stderr]: # raise ValueError("Don't use pipe to obtain stream data - it may leads to the deadlock") @@ -613,7 +606,7 @@ def execute( process = subprocess.Popen( command, shell=shell, - universal_newlines=True, + universal_newlines=text, stdout=out_file, stderr=err_file, stdin=in_file, |