From 23727d605563ce760a82ea4ba1fc9bc2b7306bad Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Wed, 3 Apr 2024 18:27:38 +0200 Subject: [PATCH] don't reset time_no_match in _answer_question, do it in run_shell_cmd --- easybuild/tools/run.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/easybuild/tools/run.py b/easybuild/tools/run.py index 24e860054b..c1d13d01d0 100644 --- a/easybuild/tools/run.py +++ b/easybuild/tools/run.py @@ -236,7 +236,6 @@ def _answer_question(stdout, proc, qa_patterns, qa_wait_patterns): except OSError as err: raise EasyBuildError("Failed to answer question raised by interactive command: %s", err) - time_no_match = 0 match_found = True break else: @@ -250,7 +249,6 @@ def _answer_question(stdout, proc, qa_patterns, qa_wait_patterns): if regex.search(stdout): _log.info(f"Found match for wait pattern '{pattern}'") _log.debug(f"Found match for wait pattern '{pattern}' at end of stdout: {stdout[:1000]}") - time_no_match = 0 match_found = True break else: @@ -435,7 +433,9 @@ def to_cmd_str(cmd): stderr += proc.stderr.read1(read_size) or b'' if qa_patterns: - if not _answer_question(stdout, proc, qa_patterns, qa_wait_patterns): + if _answer_question(stdout, proc, qa_patterns, qa_wait_patterns): + time_no_match = 0 + else: _log.debug(f"No match found in question/wait patterns at end of stdout: {stdout[:1000]}") # this will only run if the for loop above was *not* stopped by the break statement time_no_match += check_interval_secs