mirror of
https://github.com/asdf-vm/asdf-nodejs.git
synced 2024-10-06 07:42:08 +08:00
fix: adds support for pipe in paths
This commit is contained in:
parent
4d9196d0ad
commit
12ce1bfd81
10
shims/npm
10
shims/npm
@ -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() {
|
||||||
|
Loading…
Reference in New Issue
Block a user