Skip to content

Commit b3c4cd5

Browse files
committed
Fix bug: count the number of quotes instead of detecting presence
A java option of -Dfoo="bar" would fail this previously, because there are two quotes around bar, but we only detected open quotes by the presence of the double quote character.
1 parent c2273fc commit b3c4cd5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bin/utils.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ split_java_options() {
6363
option_buffer="" # buffer for collecting parts of an option
6464
opened_quotes=0 # whether we are expecting a closing double quotes
6565
for word in $1; do
66-
contains_quote=$(echo "$word" | sed "s/\\\\\"//g" | grep "\"")
67-
if [[ -n "$contains_quote" ]]; then
66+
num_quotes=$(echo "$word" | sed "s/\\\\\"//g" | grep -o "\"" | grep -c .)
67+
if [[ $((num_quotes % 2)) == 1 ]]; then
6868
# Flip the bit
6969
opened_quotes=$(((opened_quotes + 1) % 2))
7070
fi

0 commit comments

Comments
 (0)