Skip to content

Commit 760670e

Browse files
committed
Fix brew-specific check
When we find a brew-installed grep, we create an alias from ggrep to grep, but an alias can't be defined and used in the same parsing unit, so we exit early instead. See: https://www.shellcheck.net/wiki/SC2262
1 parent 4695cb7 commit 760670e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/helpers.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ function check_dependencies() {
152152
if command -v ggrep >/dev/null 2>&1; then
153153
shopt -s expand_aliases;
154154
alias grep=ggrep;
155+
156+
# The alias can't be defined and used in the same parsing unit. But
157+
# since we know the correct package is installed, we can exit early.
158+
exit
155159
fi;
156160

157161
if ! grep --version 2>&1 | grep -q "GNU grep"; then

0 commit comments

Comments
 (0)