You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I want the zstd CLI to read from a file and decompress it to stdout.
As I just learned, this can be done with zstd -d -c foo.zst. The -c option makes it decompress to stdout, whereas the default when an input filename is passed is to create a correspondingly named output file.
However, I was not expecting -c to work and only tried it after spending some time looking for other options. This is because it's documented (in both the --help output and the man page) as:
-c : force write to standard output, even if it is the console
The "even if it is the console" part refers to what happens if zstd is in compression mode and not given a filename. It reads uncompressed data from stdin and writes compressed data to stdout, but if stdout is a tty, it instead prints stdout is a console, aborting. This behavior can be suppressed with -c.
Based on the description and the option naming ('c' for console?), I thought suppressing this check was the sole effect of -c. Perhaps if I had read the man page first, -c's long alias of --stdout would have made me more likely to try it, but I started with the --help output. And my intuition was that "disable tty check" and "output to stdout instead of somewhere else" would be different options.
So perhaps the description can be clarified a bit.
P.S.: One thing I tried before learning about -c was zstd -d -o - foo.zst, which resulted in the very confusing message error: command cannot be separated from its argument by another command. It would be nice to improve the error message here, or perhaps even make -o - work.
The text was updated successfully, but these errors were encountered:
Describe the bug
I want the zstd CLI to read from a file and decompress it to stdout.
As I just learned, this can be done with
zstd -d -c foo.zst
. The-c
option makes it decompress to stdout, whereas the default when an input filename is passed is to create a correspondingly named output file.However, I was not expecting
-c
to work and only tried it after spending some time looking for other options. This is because it's documented (in both the--help
output and the man page) as:The "even if it is the console" part refers to what happens if
zstd
is in compression mode and not given a filename. It reads uncompressed data from stdin and writes compressed data to stdout, but if stdout is a tty, it instead printsstdout is a console, aborting
. This behavior can be suppressed with-c
.Based on the description and the option naming ('c' for console?), I thought suppressing this check was the sole effect of
-c
. Perhaps if I had read the man page first,-c
's long alias of--stdout
would have made me more likely to try it, but I started with the--help
output. And my intuition was that "disable tty check" and "output to stdout instead of somewhere else" would be different options.So perhaps the description can be clarified a bit.
P.S.: One thing I tried before learning about
-c
waszstd -d -o - foo.zst
, which resulted in the very confusing messageerror: command cannot be separated from its argument by another command
. It would be nice to improve the error message here, or perhaps even make-o -
work.The text was updated successfully, but these errors were encountered: