Fix #6476 Use dry run in jetty.sh (#6598)

* Fix #6597 Use dry run in jetty.sh

Use a --dry-run in jetty.sh to pre-expand the java arguments and thus avoid having two JVMs running in the case of exec.

Also made a small change to allow script to check the current directory for JETTY_BASE, as that allows testing and runs in the same style as direct calls to start.jar

Signed-off-by: Greg Wilkins <gregw@webtide.com>
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Greg Wilkins 2021-08-14 01:37:51 +10:00 committed by GitHub
parent 4af93b5e19
commit 2b0161e743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 9 deletions

View File

@ -66,7 +66,8 @@ NAME=$(echo $(basename $0) | sed -e 's/^[SK][0-9]*//' -e 's/\.sh$//')
# <Arg><Property name="jetty.home" default="."/>/webapps/jetty.war</Arg>
#
# JETTY_BASE
# Where your Jetty base directory is. If not set, the value from
# Where your Jetty base directory is. If not set, then the currently
# directory is checked, otherwise the value from
# $JETTY_HOME will be used.
#
# JETTY_RUN
@ -238,7 +239,6 @@ then
fi
fi
##################################################
# No JETTY_HOME yet? We're out of luck!
##################################################
@ -247,20 +247,23 @@ if [ -z "$JETTY_HOME" ]; then
exit 1
fi
RUN_DIR=$(pwd)
cd "$JETTY_HOME"
JETTY_HOME=$PWD
JETTY_HOME=$(pwd)
##################################################
# Set JETTY_BASE
##################################################
export JETTY_BASE
if [ -z "$JETTY_BASE" ]; then
if [ -d "$RUN_DIR/start.d" -o -f "$RUN_DIR/start.ini" ]; then
JETTY_BASE=$RUN_DIR
else
JETTY_BASE=$JETTY_HOME
fi
fi
cd "$JETTY_BASE"
JETTY_BASE=$PWD
JETTY_BASE=$(pwd)
#####################################################
# Check that jetty is where we think it is
@ -430,7 +433,7 @@ case "`uname`" in
CYGWIN*) JETTY_START="`cygpath -w $JETTY_START`";;
esac
RUN_ARGS=(${JAVA_OPTIONS[@]} -jar "$JETTY_START" ${JETTY_ARGS[*]})
RUN_ARGS=$(echo $JAVA_OPTIONS ; "$JAVA" -jar "$JETTY_START" --dry-run=opts,path,main,args ${JETTY_ARGS[*]})
RUN_CMD=("$JAVA" ${RUN_ARGS[@]})
#####################################################