Title: Improve error handling

Content: Removed set -o pipefail for better control over script flow
This commit is contained in:
ilguappo 2024-08-07 03:51:37 -07:00
parent 08d5fbdabc
commit 475858de1a

View File

@ -1,6 +1,5 @@
#!/bin/bash
set -eu
set -o pipefail
ARGS=("${@-}")
@ -65,14 +64,14 @@ curl -s "https://infer.x64.world/chat" \
-X POST \
-H "Content-Type: application/json" \
-d "${message}" | jq -r '.content | gsub("\""; "")' >"${TMP_FILE}"
kill "${SPINNER}"
# trunk-ignore(shellcheck/SC2181)
if [[ 0 -ne $? ]]; then
kill "${SPINNER}"
echo "Failed to get response."
exit 1
fi
kill "${SPINNER}"
git commit -e -m "$(cat "${TMP_FILE}")" && rm "${TMP_FILE}"