1
0
Fork 0
mirror of https://github.com/sbrl/Nibriboard.git synced 2018-01-10 21:33:49 +00:00

Bugfix validate.sh

This commit is contained in:
Starbeamrainbowlabs 2017-02-23 18:09:48 +00:00
parent 23af3da0df
commit 394f7f4284

View file

@ -1,5 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
counter_filename=$(mktemp -p /dev/shm/ -t bash.XXXXXXXXX.tmp);
echo 0 >${counter_filename};
find . -name "*.js" -not -path "./node_modules/*" | while read filename; find . -name "*.js" -not -path "./node_modules/*" | while read filename;
do do
validate_result=$(node_modules/.bin/acorn --module --silent $filename 2>&1); validate_result=$(node_modules/.bin/acorn --module --silent $filename 2>&1);
@ -8,10 +10,17 @@ do
echo ${filename}: ${validate_output} echo ${filename}: ${validate_output}
# TODO: Use /dev/shm here since apparently while is in a subshell, so it can't modify variables in the main program O.o # TODO: Use /dev/shm here since apparently while is in a subshell, so it can't modify variables in the main program O.o
if ! [ ${validate_exit_code} -eq 0 ]; then if ! [ ${validate_exit_code} -eq 0 ]; then
echo incrementing ${error_count} \($(expr ${error_count} + 1)\) error_count=$(cat ${counter_filename});
error_count=$(expr ${error_count} + 1); echo incrementing ${error_count} \($(expr ${error_count} + 1)\);
echo $(expr ${error_count} + 1) >${counter_filename};
fi fi
done done
echo error_count=$(cat ${counter_filename});
echo Errors: $error_count echo Errors: $error_count
if [[ ${error_count} -ne 0 ]]; then
exit 1;
fi
exit 0;