diff options
author | prettyboy <prettyboy@yandex-team.com> | 2023-04-20 07:30:51 +0300 |
---|---|---|
committer | prettyboy <prettyboy@yandex-team.com> | 2023-04-20 07:30:51 +0300 |
commit | 2c3286006a1757dc43c09a72baf89ad5d18daf30 (patch) | |
tree | 04bf0af0056fee7247b578ef25fcb32eef73fa4f /library/python/testing | |
parent | 4529cb782d6962d3a1e38d761cfa24a3c1bac8dd (diff) | |
download | ydb-2c3286006a1757dc43c09a72baf89ad5d18daf30.tar.gz |
[library/python/testing/yatest_common/yatest] Close non-user file descriptiors
Diffstat (limited to 'library/python/testing')
-rw-r--r-- | library/python/testing/yatest_common/yatest/common/process.py | 10 |
1 files changed, 8 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 4b76e7e33a..5e8d0342c3 100644 --- a/library/python/testing/yatest_common/yatest/common/process.py +++ b/library/python/testing/yatest_common/yatest/common/process.py @@ -230,6 +230,7 @@ class _Execution(object): if self._process_progress_listener: self._process_progress_listener() self._process_progress_listener.close() + if not self._user_stdout: if self._out_file is None: pass @@ -237,8 +238,10 @@ class _Execution(object): self._out_file.flush() self._out_file.seek(0, os.SEEK_SET) self._std_out = self._out_file.read() + self._out_file.close() else: self._std_out = self._process.stdout.read() + if not self._user_stderr: if self._err_file is None: pass @@ -246,6 +249,7 @@ class _Execution(object): self._err_file.flush() self._err_file.seek(0, os.SEEK_SET) self._std_err = self._err_file.read() + self._err_file.close() else: self._std_err = self._process.stderr.read() @@ -586,9 +590,11 @@ def execute( if stdin: name = "PIPE" if stdin == subprocess.PIPE else stdin.name - yatest_logger.debug("Executing '%s' with input '%s' in '%s'", command, name, cwd) + yatest_logger.debug( + "Executing '%s' with input '%s' in '%s' (%s)", command, name, cwd, 'waiting' if wait else 'no wait' + ) else: - yatest_logger.debug("Executing '%s' in '%s'", command, cwd) + yatest_logger.debug("Executing '%s' in '%s' (%s)", command, cwd, 'waiting' if wait else 'no wait') # XXX started = time.time() |