compress-pdf icon indicating copy to clipboard operation
compress-pdf copied to clipboard

fix the bug "streaming not working"

Open blululu opened this issue 3 years ago • 0 comments

In my testing environment,when I code like

./compress-pdf 

then output:

gs is /usr/bin/gs Awaiting pdf from stdin (stream mode)... If you meant to compress a file, use: ./compress-pdf <file>

and I input

example.pdf

nothing happened,and I check the shell code,found the cause for this:

cat - > "$infile" # line 42

the 'cat' command is used wrongly,it capture the input constantly writing to "$infile". 'read' should be used here. And also wrongly used in below code:

cat "$outfile"  # line 61

It is important to know 'cat' used to read and write file itself above , not the filename.

blululu avatar Nov 21 '21 06:11 blululu