fix(yarn): use builtin cd in completion (#12347)

This commit is contained in:
joél hawkins torres 2024-04-11 10:27:29 -07:00 committed by GitHub
parent 53c4c4671a
commit 6e9d57d5ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -86,7 +86,7 @@ _global_commands=(
) )
_yarn_find_package_json() { _yarn_find_package_json() {
local dir=$(cd "$1" && pwd) local dir=$(builtin cd "$1" && pwd)
while true while true
do do
@ -109,7 +109,7 @@ _yarn_commands_scripts() {
if [[ -n $opt_args[--cwd] ]]; then if [[ -n $opt_args[--cwd] ]]; then
packageJson=$(_yarn_find_package_json $opt_args[--cwd]) packageJson=$(_yarn_find_package_json $opt_args[--cwd])
binaries=($(cd $opt_args[--cwd] && echo node_modules/.bin/*(x:t))) binaries=($(builtin cd $opt_args[--cwd] && echo node_modules/.bin/*(x:t)))
else else
packageJson=$(_yarn_find_package_json $pwd) packageJson=$(_yarn_find_package_json $pwd)
binaries=($(echo node_modules/.bin/*(x:t))) binaries=($(echo node_modules/.bin/*(x:t)))
@ -130,9 +130,9 @@ _yarn_scripts() {
if [[ -n $_yarn_run_cwd ]]; then if [[ -n $_yarn_run_cwd ]]; then
packageJson=$(_yarn_find_package_json $_yarn_run_cwd) packageJson=$(_yarn_find_package_json $_yarn_run_cwd)
if [[ -d "${_yarn_run_cwd}/node_modules" ]]; then if [[ -d "${_yarn_run_cwd}/node_modules" ]]; then
binaries=($(cd $_yarn_run_cwd && echo node_modules/.bin/*(x:t))) binaries=($(builtin cd $_yarn_run_cwd && echo node_modules/.bin/*(x:t)))
else else
binaries=($(cd $_yarn_run_cwd && yarn bin | perl -wln -e 'm{^[^:]+: (\S+)$} and print $1')) binaries=($(builtin cd $_yarn_run_cwd && yarn bin | perl -wln -e 'm{^[^:]+: (\S+)$} and print $1'))
fi fi
else else
packageJson=$(_yarn_find_package_json $pwd) packageJson=$(_yarn_find_package_json $pwd)