On 2025-02-02 at 23:06 +0100, wrotycz wrote:
> I also and discovered that although lzip does not allow to compress
> to terminal but it does allow to decompress into terminal. Which is
> inconsistent, and not good in general imo.

This makes sense and (because of that) is what other programs are
doing.

Say I do:

$ echo Hello world | lzip
lzip: I won't write compressed data to a terminal.

Why so? lzip output in this case is binary data, which is (99%) useless
output on a user terminal, ranging from bytes that won't be
representable (e.g. 01 0c 00…) to actually changing terminal settings
to the user and breaking their terminal.

Usage of a compressing lzip with the output being a terminal is
probably missing a -o <filename>  or > <filename>


Compare that to uncompressing a file directly on the terminal:
$ < hello.lz lzip -d
Hello world


There it can be useful to show the contents directly (assuming the
compressed contentsa were of textual nature)



The issue about nul being wrongly detected as a tty in Windows seems a
bug in whatever is providing the isatty() being used by your program
(this may vary depending on the CRT being used).



Reply via email to