Fix print_index_tab to ensure cache is written

Prior to this change the `tee` call was susceptible to its output being closed causing the pipeline to exit with `SIGPIPE`. This change replaces `tee` with two parts. 

1. Write directly to `"$index_file"`
2. `cat` the contents of `"$index_file"` to `stdout`. 

This way, if the receiving side of the pipe exits, `cat` will exit without impacting the index cache

Reimplements #264
This commit is contained in:
Michael Poutre 2021-10-08 15:11:40 -07:00
parent 18f2a58981
commit ce7652263a
No known key found for this signature in database
GPG Key ID: D4E227949AA2751A

View File

@ -80,7 +80,8 @@ print_index_tab(){
cat "$index_file"
else
cat "$temp_headers_file" | awk 'tolower($1) == "etag:" { print $2 }' > "$etag_file"
echo "$index" | filter_version_candidates | tee "$index_file"
echo "$index" | filter_version_candidates > "$index_file"
cat "$index_file"
fi
rm "$temp_headers_file"