Skip to content

Commit 1cdc6b1

Browse files
committed
Fix bug: escape escaped double quotes properly
The previous code used to ignore all closing quotes if the same token also has an escaped double quote. For example, in -Dkey="I am the \"man\"" the last token contains both escaped quotes and valid quotes. This used to be interpreted as a token that doesn't have a closing quote when it actually does. This is fixed in this commit.
1 parent c854859 commit 1cdc6b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bin/utils.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ escape_java_options() {
4242
option_buffer="" # buffer for collecting parts of an option
4343
opened_quotes=0 # whether we are expecting a closing double quotes
4444
for word in $1; do
45-
contains_quote=$(echo "$word" | grep \" | grep -v \\\\\")
45+
contains_quote=$(echo "$word" | sed "s/\\\\\"//g" | grep "\"")
4646
if [[ -n "$contains_quote" ]]; then
4747
# Flip the bit
4848
opened_quotes=$(((opened_quotes + 1) % 2))

0 commit comments

Comments
 (0)