perf(yarn): skip `yarn` call if default global bin directory exists (#10290)

Fixes #10290
parent c1555314
# Add yarn bin directory to $PATH if it exists and not in $PATH already
bindir=$(yarn global bin 2>/dev/null) \
# Skip yarn call if default global bin dir exists
[[ -d "$HOME/.yarn/bin" ]] && bindir="$HOME/.yarn/bin" || bindir="$(yarn global bin 2>/dev/null)"
# Add yarn bin directory to $PATH if it exists and not already in $PATH
[[ $? -eq 0 ]] \
&& [[ -d "$bindir" ]] \
&& (( ! ${path[(Ie)$bindir]} )) \
&& path+=("$bindir")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment