Skip to content

Commit

Permalink
🐛 fix performance issue with perl
Browse files Browse the repository at this point in the history
Signed-off-by: Pranav Gaikwad <[email protected]>
  • Loading branch information
pranavgaikwad committed Dec 13, 2024
1 parent 0ca9e58 commit e157ffe
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions provider/internal/builtin/service_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,8 @@ func runOSSpecificGrepCommand(pattern string, location string, providerContext p
escapedPattern = strings.ReplaceAll(escapedPattern, "'", "'\\''")
escapedPattern = strings.ReplaceAll(escapedPattern, "$", "\\$")
cmd := fmt.Sprintf(
`find %v -type f | \
while read file; do perl -ne '/%v/ && print "$ARGV:$.:$1\n";' "$file"; done`,
`find %v -type f -print0 | \
xargs -0 perl -ne '/%v/ && print "$ARGV:$.:$1\n";'`,
location, escapedPattern,
)
findstr := exec.Command("/bin/sh", "-c", cmd)
Expand Down

0 comments on commit e157ffe

Please sign in to comment.