write_data_to_file(): add no_stdout parameter

This commit is contained in:
The MMGen Project 2025-02-16 14:42:32 +00:00
commit 52f26202a8
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 5 additions and 1 deletions

View file

@ -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()

View file

@ -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)