pobrn / mktorrent

A simple command line utility to create BitTorrent metainfo files
Other
472 stars 73 forks source link

mktorrent(1) doesn't support output to stdout #36

Open paride opened 4 years ago

paride commented 4 years ago

Forwarded from: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=699487 (slightly reworded).

A common feature that mktorrent(1) is lacking is the support for writing the resulting Bencode'd data to stdout. The issue is three-fold:

  1. - has no special meaning for --output=, and thus using --output=- results in a file named - being created in the current working directory; (unless such file exists, that is);
  2. alternatively, --output=/dev/stdout (or similar) fails because of the unconditional use of O_CREAT | O_EXCL (as I've noted in another report);
  3. finally, most of the diagnostics (excluding mainly actual errors) is directed to stdout, although it (arguably) makes sense to send them to stderr instead.

The Debian bug report contains a patch implementing this.

PS. Also to note is that as long as the use of mktorrent(1) from Shell code is considered, writing copyright information upon every invocation doesn't seem like a particularly clever idea, either. Perhaps it should be dropped altogether. Or, there could be --version…

HaniKali commented 4 years ago

command > /dev/null 2>&1 does the trick for me on linux.