From 475858de1acdf965c1108f00ec55e49c32a135f3 Mon Sep 17 00:00:00 2001 From: anaxios Date: Wed, 7 Aug 2024 03:51:37 -0700 Subject: [PATCH] Title: Improve error handling Content: Removed set -o pipefail for better control over script flow --- aicommit | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/aicommit b/aicommit index 177dcaf..d9a0086 100755 --- a/aicommit +++ b/aicommit @@ -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}"