fix: use trap to run bye on errexit (#581)

This commit is contained in:
Srijan R Shetty 2020-09-21 19:05:58 +05:30 committed by GitHub
parent 20d85d8949
commit 8b8dcc050a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -308,6 +308,7 @@ echo_contact_support() {
}
bye() { # Prints a friendly good bye message and exits the script.
set +o errexit
echo "Please share your email to receive support with the installation"
read -rp 'Email: ' email
curl -s -O --location --request POST 'https://hook.integromat.com/dkwb6i52am93pi30ojeboktvj32iw0fa' \
@ -335,6 +336,9 @@ echo -e "\U1F575 Detecting your OS"
check_os
APPSMITH_INSTALLATION_ID=$(curl -s 'https://api6.ipify.org')
# Run bye if failure happens
trap bye EXIT
curl -s -O --location --request POST 'https://hook.integromat.com/dkwb6i52am93pi30ojeboktvj32iw0fa' \
--header 'Content-Type: text/plain' \
--data-raw '{