diff options
author | Luke Bakken <[email protected]> | 2017-10-25 14:31:34 -0700 |
---|---|---|
committer | Luke Bakken <[email protected]> | 2017-10-25 14:31:34 -0700 |
commit | 6e149058b5b92a2f9134c625fce0849a8af15c1f (patch) | |
tree | 6597596e51fa45642d1700bc1e2b7bd1bd93cbba /priv/templates | |
parent | c903d54f057bca328f231c5c10f13ba42956eee2 (diff) | |
download | relx-6e149058b5b92a2f9134c625fce0849a8af15c1f.tar.gz relx-6e149058b5b92a2f9134c625fce0849a8af15c1f.tar.bz2 relx-6e149058b5b92a2f9134c625fce0849a8af15c1f.zip |
Correctly construct HEART_COMMAND and run_erl arguments
The runner script that ships with rebar builds HEART_COMMAND and run_erl arguments that preserve additional arguments the user may have passed:
https://github.com/rebar/rebar/blob/master/priv/templates/simplenode.runner#L215-L238
This PR preserves this behavior. In additon, the current code on this line sets $@ but does not do anything with the result:
https://github.com/erlware/relx/blob/master/priv/templates/extended_bin#L481-L482
Investigated in response to this ML thread: http://erlang.org/pipermail/erlang-questions/2017-October/093974.html
Diffstat (limited to 'priv/templates')
-rwxr-xr-x | priv/templates/extended_bin | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/priv/templates/extended_bin b/priv/templates/extended_bin index 87128b7..8bd9726 100755 --- a/priv/templates/extended_bin +++ b/priv/templates/extended_bin @@ -191,12 +191,6 @@ relx_escript() { "$ERTS_DIR/bin/escript" "$ROOTDIR/$scriptpath" $@ } -# Output a start command for the last argument of run_erl -relx_start_command() { - printf "exec \"%s\" \"%s\"" "$RELEASE_ROOT_DIR/bin/$REL_NAME" \ - "$START_OPTION" -} - relx_get_code_paths() { code="{ok, [{release,_,_,Apps}]} = file:consult(\"$REL_DIR/$REL_NAME.rel\"),"\ "lists:foreach(fun(A) ->"\ @@ -454,15 +448,6 @@ cd "$ROOTDIR" # Check the first argument for instructions case "$1" in start|start_boot) - - # Make sure there is not already a node running - #RES=`$NODETOOL ping` - #if [ "$RES" = "pong" ]; then - # echo "Node is already running!" - # exit 1 - #fi - # Save this for later. - CMD=$1 case "$1" in start) shift @@ -475,14 +460,10 @@ case "$1" in HEART_OPTION="start_boot" ;; esac - RUN_PARAM="$@" - - # Set arguments for the heart command - set -- "$SCRIPT_DIR/$REL_NAME" "$HEART_OPTION" - [ "$RUN_PARAM" ] && set -- "$@" "$RUN_PARAM" + RUN_PARAM="$(printf "\'%s\' " "$@")" # Export the HEART_COMMAND - HEART_COMMAND="$RELEASE_ROOT_DIR/bin/$REL_NAME $CMD" + HEART_COMMAND="$RELEASE_ROOT_DIR/bin/$REL_NAME $HEART_OPTION $RUN_PARAM" export HEART_COMMAND test -z "$PIPE_BASE_DIR" || mkdir -m 1777 -p "$PIPE_BASE_DIR" @@ -490,7 +471,7 @@ case "$1" in relx_run_hooks "$PRE_START_HOOKS" "$BINDIR/run_erl" -daemon "$PIPE_DIR" "$RUNNER_LOG_DIR" \ - "$(relx_start_command)" + "exec $RELEASE_ROOT_DIR/bin/$REL_NAME $START_OPTION $RUN_PARAM" relx_run_hooks "$POST_START_HOOKS" ;; |