Keep original file if -c or --stdout is given

Set removeSrcFile back to false when -c or --stdout is used to improve
compatibility with gzip(1) behavior.

gzip(1) is removing the original file on compression unless --stdout or
/-c is used. zstd is defaulting to keep the file unless --rm is used or
when it is called via a gzip symlink, in which it is removing by
default. Specifying -c/--stdout turns this behavior off.
This commit is contained in:
Dirk Müller
2022-03-09 23:38:59 +01:00
parent 8814aa5bfa
commit 3f4f8b04ed
4 changed files with 12 additions and 8 deletions
+4
View File
@@ -24,6 +24,10 @@ zstd -c file | zstd -t
zstd --stdout file | zstd -t
println bob | zstd | zstd -t
# Test keeping input file when compressing to stdout in gzip mode
$ZSTD_SYMLINK_DIR/gzip -c file | zstd -t ; test -f file
$ZSTD_SYMLINK_DIR/gzip --stdout file | zstd -t ; test -f file
# Test --rm
cp file file-rm
zstd --rm file-rm; zstd -t file-rm.zst