simplenode.runner: properly quote arguments

bin/<release_name> console -kernel test '[{"a","b"}]' fails, because
when $@ is inserted into CMD [{"a","b"}] is interpreted.
Fix the same issue for 'start' command and quote all arguments.
This commit is contained in:
Yurin Slava 2012-02-22 22:52:51 +07:00 committed by Tuncer Ayaz
parent 4a9dae76a4
commit cd1cc6dbee

View file

@ -72,11 +72,12 @@ case "$1" in
echo "Node is already running!" echo "Node is already running!"
exit 1 exit 1
fi fi
shift # remove $1
RUN_PARAM=$(printf "\'%s\' " "$@")
HEART_COMMAND="$RUNNER_BASE_DIR/bin/$SCRIPT start" HEART_COMMAND="$RUNNER_BASE_DIR/bin/$SCRIPT start"
export HEART_COMMAND export HEART_COMMAND
mkdir -p $PIPE_DIR mkdir -p $PIPE_DIR
shift # remove $1 $ERTS_PATH/run_erl -daemon $PIPE_DIR $RUNNER_LOG_DIR "exec $RUNNER_BASE_DIR/bin/$SCRIPT console $RUN_PARAM" 2>&1
$ERTS_PATH/run_erl -daemon $PIPE_DIR $RUNNER_LOG_DIR "exec $RUNNER_BASE_DIR/bin/$SCRIPT console $@" 2>&1
;; ;;
stop) stop)
@ -160,21 +161,21 @@ case "$1" in
BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin BINDIR=$ROOTDIR/erts-$ERTS_VSN/bin
EMU=beam EMU=beam
PROGNAME=`echo $0 | sed 's/.*\\///'` PROGNAME=`echo $0 | sed 's/.*\\///'`
CMD="$BINDIR/erlexec -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -mode embedded -config $CONFIG_PATH -args_file $VMARGS_PATH -- ${1+"$@"}" CMD="$BINDIR/erlexec -boot $RUNNER_BASE_DIR/releases/$APP_VSN/$BOOTFILE -mode embedded -config $CONFIG_PATH -args_file $VMARGS_PATH"
export EMU export EMU
export ROOTDIR export ROOTDIR
export BINDIR export BINDIR
export PROGNAME export PROGNAME
# Dump environment info for logging purposes # Dump environment info for logging purposes
echo "Exec: $CMD" echo "Exec: $CMD" -- ${1+"$@"}
echo "Root: $ROOTDIR" echo "Root: $ROOTDIR"
# Log the startup # Log the startup
logger -t "$SCRIPT[$$]" "Starting up" logger -t "$SCRIPT[$$]" "Starting up"
# Start the VM # Start the VM
exec $CMD exec $CMD -- ${1+"$@"}
;; ;;
*) *)