diff options
| author | Michael Klishin <michael@clojurewerkz.org> | 2017-05-08 18:01:10 +0300 |
|---|---|---|
| committer | Michael Klishin <michael@clojurewerkz.org> | 2017-05-08 18:01:10 +0300 |
| commit | 7132664520b09cf6e15dc95e91ce73eedd4407e4 (patch) | |
| tree | 34d0b51dabde73dbde00e2b928e4b52450eaaee8 /scripts | |
| parent | d6fa2093375ac295b765261e34213de4a61960b9 (diff) | |
| parent | 0bd4b78b3540c65648563714239d2a270c9816a4 (diff) | |
| download | rabbitmq-server-git-7132664520b09cf6e15dc95e91ce73eedd4407e4.tar.gz | |
Merge branch 'master' into rabbitmq-server-1146-full
Conflicts:
Makefile
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/rabbitmq-env.bat | 7 | ||||
| -rwxr-xr-x | scripts/rabbitmq-server | 41 |
2 files changed, 36 insertions, 12 deletions
diff --git a/scripts/rabbitmq-env.bat b/scripts/rabbitmq-env.bat index 56b2f69b2d..9d7a724318 100644 --- a/scripts/rabbitmq-env.bat +++ b/scripts/rabbitmq-env.bat @@ -417,7 +417,12 @@ set paths= exit /b
:filter_path
-set ERL_LIBS=%ERL_LIBS%;%~dps1%~n1%~x1
+REM Ensure ERL_LIBS begins with valid path
+IF [%ERL_LIBS%] EQU [] (
+ set ERL_LIBS=%~dps1%~n1%~x1
+) else (
+ set ERL_LIBS=%ERL_LIBS%;%~dps1%~n1%~x1
+)
exit /b
:filter_paths_done
diff --git a/scripts/rabbitmq-server b/scripts/rabbitmq-server index 41d1a81332..a318b55d75 100755 --- a/scripts/rabbitmq-server +++ b/scripts/rabbitmq-server @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/sh ## The contents of this file are subject to the Mozilla Public License ## Version 1.1 (the "License"); you may not use this file except in ## compliance with the License. You may obtain a copy of the License @@ -12,9 +12,11 @@ ## The Original Code is RabbitMQ. ## ## The Initial Developer of the Original Code is GoPivotal, Inc. -## Copyright (c) 2007-2015 Pivotal Software, Inc. All rights reserved. +## Copyright (c) 2007-2017 Pivotal Software, Inc. All rights reserved. ## +set -e + # Get default settings with user overrides for (RABBITMQ_)<var_name> # Non-empty defaults should be set in rabbitmq-env . `dirname $0`/rabbitmq-env @@ -278,21 +280,38 @@ else # The Erlang VM should ignore SIGINT. RABBITMQ_SERVER_START_ARGS="${RABBITMQ_SERVER_START_ARGS} ${RABBITMQ_IGNORE_SIGINT_FLAG}" - # Signal handlers. They all stop RabbitMQ properly (using - # rabbitmqctl stop). Depending on the signal, this script will exit - # with a non-zero error code: + # Signal handlers. They all stop RabbitMQ properly, using + # rabbitmqctl stop. This script will exit with different exit codes: # SIGHUP SIGTERM SIGTSTP - # They are considered a normal process termination, so the script - # exits with 0. + # Exits 0 since this is considered a normal process termination. # SIGINT - # They are considered an abnormal process termination, the script - # exits with the job exit code. + # Exits 128 + $signal_number where $signal_number is 2 for SIGINT (see + # http://pubs.opengroup.org/onlinepubs/009695399/utilities/kill.html). + # This is considered an abnormal process termination. Normally, we + # don't need to specify this exit code because the shell propagates it. + # Unfortunately, the signal handler doesn't work as expected in Dash, + # thus we need to explicitely restate the exit code. trap "stop_rabbitmq_server; exit 0" HUP TERM TSTP - trap "stop_rabbitmq_server" INT + trap "stop_rabbitmq_server; exit 130" INT start_rabbitmq_server "$@" & + rabbitmq_server_pid=$! # Block until RabbitMQ exits or a signal is caught. # Waits for last command (which is start_rabbitmq_server) - wait $! + # + # The "|| true" is here to work around an issue with Dash. Normally + # in a Bourne shell, if `wait` is interrupted by a signal, the + # signal handlers defined above are executed and the script + # terminates with the exit code of `wait` (unless the signal handler + # overrides that). + # In the case of Dash, it looks like `set -e` (set at the beginning + # of this script) gets precedence over signal handling. Therefore, + # when `wait` is interrupted, its exit code is non-zero and because + # of `set -e`, the script terminates immediately without running the + # signal handler. To work around this issue, we use "|| true" to + # force that statement to succeed and the signal handler to properly + # execute. Because the statement below has an exit code of 0, the + # signal handler has to restate the expected exit code. + wait $rabbitmq_server_pid || true fi |
