fix: adds support for pipe in paths

This commit is contained in:
Augusto Moura 2021-07-19 15:44:21 -03:00
parent 4d9196d0ad
commit 12ce1bfd81
No known key found for this signature in database
GPG Key ID: 67F85AF470AE27DA

View File

@ -9,9 +9,13 @@ set -o pipefail
this_dir="$(dirname "${BASH_SOURCE[0]}")" this_dir="$(dirname "${BASH_SOURCE[0]}")"
plugin_name="$(basename "$(dirname "$this_dir")")" plugin_name="$(basename "$(dirname "$this_dir")")"
# Remove current script from path and search the next npm script available quote_path() {
# It works because asdf-core adds the every binarie path candidate in path before calling this script sed 's/\\/\\\\/g; s/\//\\\//g' <<< "$1"
filtered_path="$(sed "s|$this_dir||g; s|::|:|g" <<< "$PATH")" }
# Remove current script from path and search the next npm executable
# It works because asdf-core adds every binary path candidate to PATH before calling this script
filtered_path="$(sed "s/$(quote_path "$this_dir")//g; s/::/:/g" <<< "$PATH")"
npm="$(PATH="$filtered_path" command -v npm)" npm="$(PATH="$filtered_path" command -v npm)"
should_reshim() { should_reshim() {