Skip to content

Commit f564a36

Browse files
committed
De-magic number exit statuses
1 parent e3cb570 commit f564a36

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

arduino-ci-script.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ function install_package()
453453
local -r unsupportedInstallBoardsOptionVersionsRange2regex="1.6.[0-3]"
454454
if [[ "$NEWEST_INSTALLED_IDE_VERSION" =~ $unsupportedInstallBoardsOptionVersionsRange1regex || "$NEWEST_INSTALLED_IDE_VERSION" =~ $unsupportedInstallBoardsOptionVersionsRange2regex ]]; then
455455
echo "ERROR: --install-boards option is not supported by the newest version of the Arduino IDE you have installed. You must have Arduino IDE 1.6.4 or newer installed to use this function."
456-
return 1
456+
return "$ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS"
457457
else
458458
# Temporarily install the latest IDE version to use for the package installation
459459
install_ide_version "$NEWEST_INSTALLED_IDE_VERSION"
@@ -549,7 +549,7 @@ function install_library()
549549
local -r unsupportedInstallLibraryOptionVersionsRange2regex="1.6.[0-3]"
550550
if [[ "$NEWEST_INSTALLED_IDE_VERSION" =~ $unsupportedInstallLibraryOptionVersionsRange1regex || "$NEWEST_INSTALLED_IDE_VERSION" =~ $unsupportedInstallLibraryOptionVersionsRange2regex ]]; then
551551
echo "ERROR: --install-library option is not supported by the newest version of the Arduino IDE you have installed. You must have Arduino IDE 1.6.4 or newer installed to use this function."
552-
return 1
552+
return "$ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS"
553553
else
554554
local -r libraryName="$1"
555555

@@ -577,7 +577,7 @@ function extract
577577
# display usage if no parameters given
578578
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
579579
echo " extract <path/file_name_1.ext> [path/file_name_2.ext] [path/file_name_3.ext]"
580-
return 1
580+
return "$ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS"
581581
else
582582
local filename
583583
for filename in "$@"
@@ -616,12 +616,12 @@ function extract
616616
;;
617617
*)
618618
echo "extract: '$filename' - unknown archive method"
619-
return 1
619+
return "$ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS"
620620
;;
621621
esac
622622
else
623623
echo "extract: '$filename' - file does not exist"
624-
return 1
624+
return "$ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS"
625625
fi
626626
done
627627
fi
@@ -886,18 +886,18 @@ function publish_report_to_repository()
886886
fi
887887
else
888888
echo "ERROR: Failed to push to remote branch."
889-
return 3
889+
return "$ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS"
890890
fi
891891
else
892892
echo "ERROR: Failed to clone branch ${reportBranch} of repository URL ${repositoryURL}. Do they exist?"
893-
return 2
893+
return "$ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS"
894894
fi
895895
else
896896
echo "No report file available for this job"
897897
fi
898898
else
899899
echo "Publishing report failed. GitHub token, repository URL, and repository branch must be defined to use this function. See https://github.com/per1234/arduino-ci-script#publishing-job-reports for instructions."
900-
return 1
900+
return "$ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS"
901901
fi
902902

903903
disable_verbosity
@@ -943,7 +943,7 @@ curlDataHere
943943
fi
944944
else
945945
echo "Publishing report failed. GitHub token and gist URL must be defined in your Travis CI settings for this repository in order to use this function. See https://github.com/per1234/arduino-ci-script#publishing-job-reports for instructions."
946-
return 1
946+
return "$ARDUINO_CI_SCRIPT_FAILURE_EXIT_STATUS"
947947
fi
948948

949949
disable_verbosity

0 commit comments

Comments
 (0)