Title: Enforce directory change and handle failure

Content: Fix popd command to handle potential errors.
This commit is contained in:
ilguappo 2024-08-07 03:38:37 -07:00
parent 7a102dec96
commit 241b951a00

View File

@ -1,5 +1,11 @@
#!/bin/bash #!/bin/bash
pushd $(pwd) >/dev/null
set -eu
set -o pipefail
ARGS=("${@-}")
pushd $(pwd) >/dev/null || exit 1
TMP_FILE="/tmp/aicommit" TMP_FILE="/tmp/aicommit"
@ -40,4 +46,4 @@ fi
git commit -e -m "$(cat ${TMP_FILE})" && rm ${TMP_FILE} git commit -e -m "$(cat ${TMP_FILE})" && rm ${TMP_FILE}
popd >/dev/null popd >/dev/null || exit 1