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