Skip to content

Commit

Permalink
Merge pull request #140 from eclipse/quotedArgs
Browse files Browse the repository at this point in the history
exec jetty.start from file to preserve quoted arguments
  • Loading branch information
lachlan-roberts authored May 2, 2023
2 parents 9b0bcc7 + cdcd0fa commit 566a01b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
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

0 comments on commit 566a01b

Please sign in to comment.