Skip to content

Commit

Permalink
Fix bug: escape escaped backslashes and quotes properly...
Browse files Browse the repository at this point in the history
This is so that the way this is parsed and the way Java parses
its java opts is consistent.
  • Loading branch information
andrewor14 committed Aug 7, 2014
1 parent 1cdc6b1 commit 45a1eb9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ escape_java_options() {
fi
if [[ $opened_quotes == 0 ]]; then
# Remove all non-escaped quotes around the value
ESCAPED_JAVA_OPTS+=("$(echo "$option_buffer $word" | sed "s/^[[:space:]]*//" | sed "s/\([^\\]\)\"/\1/g")")
ESCAPED_JAVA_OPTS+=("$(
echo "$option_buffer $word" | \
sed "s/^[[:space:]]*//" | \
sed "s/\([^\\]\)\"/\1/g" | \
sed "s/\\\\\([\\\"]\)/\1/g"
)")
option_buffer=""
else
# We are expecting a closing double quote, so keep buffering
Expand Down

0 comments on commit 45a1eb9

Please sign in to comment.