From 241b951a006b2342fb5d9454dd3318be3dc5001a Mon Sep 17 00:00:00 2001 From: anaxios Date: Wed, 7 Aug 2024 03:38:37 -0700 Subject: [PATCH] Title: Enforce directory change and handle failure Content: Fix popd command to handle potential errors. --- aicommit_groq | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/aicommit_groq b/aicommit_groq index 9b541b6..9856ced 100755 --- a/aicommit_groq +++ b/aicommit_groq @@ -1,5 +1,11 @@ #!/bin/bash -pushd $(pwd) >/dev/null + +set -eu +set -o pipefail + +ARGS=("${@-}") + +pushd $(pwd) >/dev/null || exit 1 TMP_FILE="/tmp/aicommit" @@ -40,4 +46,4 @@ fi git commit -e -m "$(cat ${TMP_FILE})" && rm ${TMP_FILE} -popd >/dev/null +popd >/dev/null || exit 1