Skip to content

Commit 0ca9fed

Browse files
committed
refactor(find-in-jars): add IFS= for read, more robust 💪
file paths may contain leading spaces
1 parent 0b4180c commit 0ca9fed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

bin/find-in-jars

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ __outputResultOfJarFile() {
378378
# Prevent grep from exiting in case of no match
379379
# https://unix.stackexchange.com/questions/330660
380380
grep "${grep_opt_args[@]}" || true
381-
} | while read -r file; do
381+
} | while IFS= read -r file; do
382382
clearResponsiveMessage
383383
if [ -t 1 ]; then
384384
printf "$JAR_COLOR%s$SEP_COLOR%s$COLOR_RESET%s\n" "$jar_file" "$separator" "$file"
@@ -394,7 +394,7 @@ findInJarFiles() {
394394
local counter=1 total_jar_count jar_file
395395

396396
read -r total_jar_count
397-
while read -r jar_file; do
397+
while IFS= read -r jar_file; do
398398
printResponsiveMessage "finding in jar($((counter++))/$total_jar_count): $jar_file"
399399
listZipEntries "$jar_file" | __outputResultOfJarFile "$jar_file"
400400
done

0 commit comments

Comments
 (0)