From d770f1d7a14264283868881e51582670bd6336e7 Mon Sep 17 00:00:00 2001 From: Vladimir Oltean Date: Sat, 25 Oct 2025 16:20:24 +0300 Subject: [PATCH] ingest_mdir: introduce --noninteractive option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is useful for capturing the process' stdout to a pipe, and e.g. emailing it. Before: ynl  Full series OKAY  Generated files up to date; no warnings/errors; no diff in generated; maintainers  Full series OKAY  No new files, skip fixes_present  Full series OKAY  Fixes tag present in non-next series After: ynl Full series OKAY Generated files up to date; no warnings/errors; no diff in generated; maintainers Full series OKAY No new files, skip fixes_present Full series OKAY Fixes tag present in non-next series Signed-off-by: Vladimir Oltean --- ingest_mdir.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/ingest_mdir.py b/ingest_mdir.py index a966622..f2e253d 100755 --- a/ingest_mdir.py +++ b/ingest_mdir.py @@ -27,6 +27,7 @@ from core import Tester CONSOLE_WIDTH = None +NONINTERACTIVE = False BOLD = '\033[1m' RED = '\033[31m' GREEN = '\033[32m' @@ -55,6 +56,8 @@ help='disable test, can be specified multiple times') parser.add_argument('-t', '--test', nargs='+', help='run only specified tests. Note: full test name is needed, e.g. "patch/pylint" or "series/ynl" not just "pylint" or "ynl"') +parser.add_argument('--noninteractive', action='store_true', + help='Avoid printing terminal control characters to output which is not a terminal') parser.add_argument('--dbg-print-run', help='print results of previous run') @@ -99,7 +102,9 @@ def __print_summary_result(offset, files, full_path): print(RED + "FAIL " + RESET + f"({retcode})", end='') failed = True - if failed or (desc and len(desc) + offset > get_console_width()): + wrap_on_width = not NONINTERACTIVE and \ + (desc and len(desc) + offset > get_console_width()) + if failed or wrap_on_width: print("\n", end=" ") if desc: print("", desc, end='') @@ -271,6 +276,16 @@ def main(): args = parser.parse_args() + global NONINTERACTIVE + if args.noninteractive: + NONINTERACTIVE = True + global BOLD, RED, GREEN, YELLOW, RESET + BOLD = '' + RED = '' + GREEN = '' + YELLOW = '' + RESET = '' + args.tree = os.path.abspath(args.tree) if args.test: