Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exec jetty.start from file to preserve quoted arguments #140

Merged
merged 1 commit into from
May 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ if expr "$*" : 'java .*/start\.jar.*$' >/dev/null ; then
# It is a terminating command, so exec directly
JAVA="$1"
shift
exec $JAVA $JAVA_OPTIONS "$@"
exec $JAVA $JAVA_OPTIONS "$@" $JETTY_PROPERTIES
esac
done

Expand All @@ -88,11 +88,13 @@ if expr "$*" : 'java .*/start\.jar.*$' >/dev/null ; then
/generate-jetty-start.sh "$@"
fi
echo $(date +'%Y-%m-%d %H:%M:%S.000'):INFO:docker-entrypoint:jetty start from $JETTY_START
set -- $(cat $JETTY_START)
else
/generate-jetty-start.sh "$@"
set -- $(cat $JETTY_START)
fi

## The generate-jetty-start script always starts the jetty.start file with exec, so this command will exec Jetty.
## We need to do this because the file may have quoted arguments which cannot be read into a variable.
. $JETTY_START
fi

if [ "${1##*/}" = java -a -n "$JAVA_OPTIONS" ] ; then
Expand Down
2 changes: 1 addition & 1 deletion generate-jetty-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [ -z "$JETTY_START" ] ; then
fi
rm -f $JETTY_START
DRY_RUN=$(/docker-entrypoint.sh "$@" --dry-run)
echo "$DRY_RUN" \
echo "exec $DRY_RUN" \
| egrep '[^ ]*java .* org\.eclipse\.jetty\.xml\.XmlConfiguration ' \
| sed -e 's/ -Djava.io.tmpdir=[^ ]*//g' -e 's/\\$//' \
> $JETTY_START
Expand Down