Update the check_running() function in refine

In strict shell environments, the "$?" is reset when evaluated.
Here, the "boolean if" statements compares it to "7", then reset it and compares it to "22".
If the "$?" is intially "22", it is not evaluated and the NOT_RUNNING variable is ignored while it shouldn't. this leads to the error
"Something is already running on http://127.0.0.1:3333/"

To avoid this, the solution is to first affect the value of "$?" to a non-system variable and then evaluate this new variable.
This commit is contained in:
Negens 2020-01-08 13:34:49 +01:00 committed by GitHub
parent e98dd26992
commit a4ee71a29d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

3
refine
View File

@ -157,7 +157,8 @@ check_running() {
if [ "$CURL" ] ; then if [ "$CURL" ] ; then
curl -s -S -f $URL > /dev/null 2>&1 curl -s -S -f $URL > /dev/null 2>&1
if [ "$?" = "7" ] || [ "$?" = "22" ] ; then CURL_RETURN=$?
if [ $CURL_RETURN -eq "7" ] || [ $CURL_RETURN -eq "22" ] ; then
NOT_RUNNING="1" NOT_RUNNING="1"
fi fi
elif [ "$WGET" ] ; then elif [ "$WGET" ] ; then