Browse Source

write_data_to_file(): add `no_stdout` parameter

The MMGen Project 1 month ago
parent
commit
52f26202a8
2 changed files with 5 additions and 1 deletions
  1. 4 1
      mmgen/fileutil.py
  2. 1 0
      test/include/common.py

+ 4 - 1
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()

+ 1 - 0
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)