From 9605a118df93b17e6259f4e99ce8348417c87ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BE=9D=E7=91=AA=E8=B2=93?= Date: Sat, 19 Mar 2022 21:39:07 +0800 Subject: [PATCH] Revised the compression and decompression parameters to run binaries programs. --- reslog | 8 ++++---- t/_helper.pm | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/reslog b/reslog index 69eab6a..587a33b 100755 --- a/reslog +++ b/reslog @@ -1760,7 +1760,7 @@ sub open_write : method { ($self->{"file"}, $self->{"FH"}) = ($file, $FH); $EXEC = where_is "bzip2" if !defined $EXEC; - @_ = ($EXEC, "-9f"); + @_ = ($EXEC, "-c9f"); @_ = map "\"$_\"", @_ if $^O eq "MSWin32"; $CMD = join " ", @_; print STDERR " Starting $CMD to file ... " if $VERBOSE > 2; @@ -1831,7 +1831,7 @@ sub open_append : method { open STDIN, "<&", $STDIN or die "$THIS_FILE: STDIN: $!"; print STDERR "done\n" if $VERBOSE > 2; - @_ = ($EXEC, "-9f"); + @_ = ($EXEC, "-c9f"); @_ = map "\"$_\"", @_ if $^O eq "MSWin32"; $CMD = join " ", @_; print STDERR " Starting $CMD to file ... " if $VERBOSE > 2; @@ -1859,7 +1859,7 @@ sub open_append : method { # A whole new file } else { - @_ = ($EXEC, "-9f"); + @_ = ($EXEC, "-c9f"); @_ = map "\"$_\"", @_ if $^O eq "MSWin32"; $CMD = join " ", @_; print STDERR " Starting $CMD to file ... " if $VERBOSE > 2; @@ -1919,7 +1919,7 @@ sub close : method { # Create empty compressed content print STDERR " Applying empty compressed content ... " if $VERBOSE > 2; $EXEC = where_is "bzip2" if !defined $EXEC; - @_ = ($EXEC, "-9f"); + @_ = ($EXEC, "-c9f"); @_ = map "\"$_\"", @_ if $^O eq "MSWin32"; $CMD = join " ", @_; # Redirect STDOUT to $FH diff --git a/t/_helper.pm b/t/_helper.pm index 9d3842d..c7ac4e5 100644 --- a/t/_helper.pm +++ b/t/_helper.pm @@ -200,7 +200,7 @@ sub read_file($) { } else { my ($PH, $CMD); $CMD = where_is "gzip"; - $CMD = "\"$CMD\" -cd \"$file\""; + $CMD = "\"$CMD\" -cdf \"$file\""; open $PH, "$CMD |" or die this_file . ": $CMD: $!"; $content = join "", <$PH>; close $PH or die this_file . ": $CMD: $!"; @@ -223,7 +223,7 @@ sub read_file($) { } else { my ($PH, $CMD); $CMD = where_is "bzip2"; - $CMD = "bzip2 -cd \"$file\""; + $CMD = "bzip2 -cdf \"$file\""; open $PH, "$CMD |" or die this_file . ": $CMD: $!"; $content = join "", <$PH>; close $PH or die this_file . ": $CMD: $!"; @@ -326,7 +326,7 @@ sub write_file($$) { } else { my ($PH, $CMD); $CMD = where_is "bzip2"; - $CMD = "\"$CMD\" -9f > \"$file\""; + $CMD = "\"$CMD\" -c9f > \"$file\""; open $PH, "| $CMD" or die this_file . ": $CMD: $!"; print $PH $content or die this_file . ": $CMD: $!"; close $PH or die this_file . ": $CMD: $!";