From 52f26202a866896b96351b998ab3ade96a3e9279 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sun, 16 Feb 2025 14:42:32 +0000 Subject: [PATCH] write_data_to_file(): add `no_stdout` parameter --- mmgen/fileutil.py | 5 ++++- test/include/common.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mmgen/fileutil.py b/mmgen/fileutil.py index 8dba096f..25a71757 100755 --- a/mmgen/fileutil.py +++ b/mmgen/fileutil.py @@ -159,6 +159,7 @@ def write_data_to_file( ask_overwrite = True, ask_tty = True, no_tty = False, + no_stdout = False, quiet = False, binary = False, ignore_opt_outdir = False, @@ -269,7 +270,9 @@ def write_data_to_file( return True - if cfg.stdout or outfile in ('', '-'): + if no_stdout: + do_file(outfile, ask_write_prompt) + elif cfg.stdout or outfile in ('', '-'): do_stdout() elif sys.stdin.isatty() and not sys.stdout.isatty(): do_stdout() diff --git a/test/include/common.py b/test/include/common.py index 541802f7..6c664aeb 100755 --- a/test/include/common.py +++ b/test/include/common.py @@ -205,6 +205,7 @@ def write_to_file(fn, data, binary=False): fn, data, quiet = True, + no_stdout = True, binary = binary, ignore_opt_outdir = True)