Check curl exit code.

This commit is contained in:
Shy 2024-08-02 08:39:05 +02:00
parent 4fcb815c14
commit edbc155a59

6
wled
View file

@ -52,6 +52,12 @@ case "$2" in
;; ;;
esac esac
curl_exit=$?
if test $curl_exit -ne 0; then
echo "Error: curl exited with exit code $curl_exit."
exit 1
fi
# Check API responce. Should be {"success":true}. # Check API responce. Should be {"success":true}.
if test "$(echo -n "$api_resp"|tr -c -d '[:alpha:]')" != 'successtrue'; then if test "$(echo -n "$api_resp"|tr -c -d '[:alpha:]')" != 'successtrue'; then
echo "Error: unexpected responce from WLED API." >&2 echo "Error: unexpected responce from WLED API." >&2