Skip to content

Commit 45a1eb9

Browse files
committed
Fix bug: escape escaped backslashes and quotes properly...
This is so that the way this is parsed and the way Java parses its java opts is consistent.
1 parent 1cdc6b1 commit 45a1eb9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bin/utils.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,12 @@ escape_java_options() {
4949
fi
5050
if [[ $opened_quotes == 0 ]]; then
5151
# Remove all non-escaped quotes around the value
52-
ESCAPED_JAVA_OPTS+=("$(echo "$option_buffer $word" | sed "s/^[[:space:]]*//" | sed "s/\([^\\]\)\"/\1/g")")
52+
ESCAPED_JAVA_OPTS+=("$(
53+
echo "$option_buffer $word" | \
54+
sed "s/^[[:space:]]*//" | \
55+
sed "s/\([^\\]\)\"/\1/g" | \
56+
sed "s/\\\\\([\\\"]\)/\1/g"
57+
)")
5358
option_buffer=""
5459
else
5560
# We are expecting a closing double quote, so keep buffering

0 commit comments

Comments
 (0)