mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-25 23:16:16 +01:00
Merge bitcoin/bitcoin#34089: contrib: asmap-tool.py - Don't write binary to TTY
e7e51952dccontrib: Avoid outputting binary data to TTY (Hodlinator) Pull request description: Verify that we wouldn't be writing encoded asmap binary data directly to the TTY since it is the default but makes no sense. (Having stdout as default does make sense when piping to other applications however). Found while exploring the ASMap data pipeline (https://github.com/asmap/asmap-data/pull/38#pullrequestreview-3547352533) from Kartograf into Bitcoin Core. ACKs for top commit: fjahr: tACKe7e51952dcsipa: ACKe7e51952dcTree-SHA512: e1ae1ee129715471cbb824268e68cec267d159d4073297af35c06eadfb6b98eeae040beaafeb6489c2853ea9b83cd04471bcd0b27f0ae8fcb377e6e10b4ae6c5
This commit is contained in:
@@ -131,6 +131,8 @@ def main():
|
||||
if args.subcommand is None:
|
||||
parser.print_help()
|
||||
elif args.subcommand == "encode":
|
||||
if args.outfile.isatty():
|
||||
sys.exit("Not much use in writing binary to a TTY. Please specify an output file or pipe output to another process.")
|
||||
state = load_file(args.infile)
|
||||
save_binary(args.outfile, state, fill=args.fill)
|
||||
elif args.subcommand == "decode":
|
||||
|
||||
Reference in New Issue
Block a user