Skip to content

Commit

Permalink
Fix #6597 Use dry run in jetty.sh
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
gregw committed Aug 11, 2021
1 parent cc8ece5 commit 96355fd
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions jetty-home/src/main/resources/bin/jetty.sh
Expand Up @@ -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
Expand Down Expand Up @@ -238,7 +239,6 @@ then
fi
fi


##################################################
# No JETTY_HOME yet? We're out of luck!
##################################################
Expand All @@ -247,21 +247,24 @@ if [ -z "$JETTY_HOME" ]; then
exit 1
fi

RUN_DIR=$PWD
cd "$JETTY_HOME"
JETTY_HOME=$PWD


##################################################
# Set JETTY_BASE
##################################################
export JETTY_BASE
if [ -z "$JETTY_BASE" ]; then
JETTY_BASE=$JETTY_HOME
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


#####################################################
# Check that jetty is where we think it is
#####################################################
Expand Down Expand Up @@ -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=$("$JAVA" ${JAVA_OPTIONS[@]} -jar "$JETTY_START" --dry-run=opts,path,main,args ${JETTY_ARGS[*]})
RUN_CMD=("$JAVA" ${RUN_ARGS[@]})

#####################################################
Expand Down

0 comments on commit 96355fd

Please sign in to comment.