File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ trap_with_arg() {
2020}
2121
2222deregister_runner () {
23+ COMMAND_EXIT_CODE=$?
2324 echo " Caught $1 - Deregistering runner"
2425 if [[ -n " ${ACCESS_TOKEN} " ]]; then
2526 # If using GitHub App authentication, refresh the access token before deregistration
@@ -40,7 +41,11 @@ deregister_runner() {
4041 fi
4142 ./config.sh remove --token " ${RUNNER_TOKEN} "
4243 [[ -f " /actions-runner/.runner" ]] && rm -f /actions-runner/.runner
43- exit
44+
45+ # Simply calling `exit` on different environments will either return the exit code of the passed-in $@ command, or
46+ # the exit code of the last executed command in this function. To ensure that the behavior is consistent, we always
47+ # return the exit code of the passed-in command, which is stored in COMMAND_EXIT_CODE.
48+ exit ${COMMAND_EXIT_CODE}
4449}
4550
4651_DEBUG_ONLY=${DEBUG_ONLY:- false}
You can’t perform that action at this time.
0 commit comments