From 50caf0240f7b0792ab2869b42f73626f1635fd26 Mon Sep 17 00:00:00 2001 From: Akolzin Dmitry Date: Mon, 18 May 2020 11:53:03 +0300 Subject: [PATCH] exit for encoding error (#107) --- bin/build | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/build b/bin/build index 076f729d..6e91f773 100644 --- a/bin/build +++ b/bin/build @@ -30,8 +30,12 @@ echo "Update version and date in the file \"version.php\"" for i in `find ./"$version" -type f -name '*.*'`; do encoding=`file -b --mime-encoding "$i"` if [ "$encoding" != "iso-8859-1" ] && [ "$encoding" != "binary" ]; then - iconv -c -f $encoding -t "cp1251" $i >> $i.cp1251 - mv $i.cp1251 $i + result=$(iconv -f $encoding -t "cp1251" $i -o $i.cp1251 2>&1 > /dev/null) + if [ ! -z "$result" ]; then + echo "Errors in file $i" + echo $result + exit 255 + fi fi done echo "Encoding the file has changed"