Suppress subsequent errors in svg_check.sh

This code was introduced via I02715a5. In case there is something
wrong with the svgo call (e.g. when my local node_modules are not
up to date), I get many unrelated error messages that are more
confusing than helpful. The first error on the svgo call is still
shown.

Bug: T280923
Change-Id: I5ef7843c9de122c8dce61fbb98737c8acdd0c22c
This commit is contained in:
Thiemo Kreuz 2021-04-29 10:41:21 +02:00
parent 22e288f3ab
commit de9577d2a8

View file

@ -3,13 +3,15 @@ found=0
for svgfile in `find resources -type f -name "*.svg"`; do
outfile="$svgfile.tmp"
node_modules/.bin/svgo --config .svgo.config.js -i $svgfile -o $outfile -q
if [ $(wc -c $svgfile | awk '{print $1}') -gt $(wc -c $outfile | awk '{print $1}') ]; then
echo "File $svgfile is not compressed"
found=$((found + 1))
if [ -f $outfile ]; then
if [ $(wc -c $svgfile | awk '{print $1}') -gt $(wc -c $outfile | awk '{print $1}') ]; then
echo "File $svgfile is not compressed"
found=$((found + 1))
fi
rm $outfile
fi
rm $outfile
done
if [ $found -gt 0 ]; then
echo "Found $found uncompressed SVG files. Please compress the files and re-submit the patch"
exit 1
fi
fi