From dbeeb683daa1e500d7c29d876a91bd00aa3342c8 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Sun, 18 Jan 2015 23:55:26 -0800 Subject: [PATCH] Fix `nvm_strip_path` for >= v0.12.0 node, and all io.js versions. --- nvm.sh | 8 +++++++- test/fast/Unit tests/nvm_strip_path | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/nvm.sh b/nvm.sh index f75d9b0..def98f4 100644 --- a/nvm.sh +++ b/nvm.sh @@ -264,7 +264,13 @@ nvm_num_version_groups() { } nvm_strip_path() { - echo "$1" | command sed -e "s#$NVM_DIR/[^/]*$2[^:]*:##g" -e "s#:$NVM_DIR/[^/]*$2[^:]*##g" -e "s#$NVM_DIR/[^/]*$2[^:]*##g" + echo "$1" | command sed \ + -e "s#$NVM_DIR/[^/]*$2[^:]*:##g" \ + -e "s#:$NVM_DIR/[^/]*$2[^:]*##g" \ + -e "s#$NVM_DIR/[^/]*$2[^:]*##g" \ + -e "s#$NVM_DIR/versions/[^/]*/[^/]*$2[^:]*:##g" \ + -e "s#:$NVM_DIR/versions/[^/]*/[^/]*$2[^:]*##g" \ + -e "s#$NVM_DIR/versions/[^/]*/[^/]*$2[^:]*##g" } nvm_prepend_path() { diff --git a/test/fast/Unit tests/nvm_strip_path b/test/fast/Unit tests/nvm_strip_path index 0d119aa..b926cc4 100755 --- a/test/fast/Unit tests/nvm_strip_path +++ b/test/fast/Unit tests/nvm_strip_path @@ -4,7 +4,7 @@ die () { echo $@ ; exit 1; } . ../../../nvm.sh -TEST_PATH=$NVM_DIR/v0.10.5/bin:/usr/bin:$NVM_DIR/v0.11.5/bin:$NVM_DIR/v0.9.5/bin:/usr/local/bin:$NVM_DIR/v0.2.5/bin +TEST_PATH=$NVM_DIR/v0.10.5/bin:/usr/bin:$NVM_DIR/v0.11.5/bin:$NVM_DIR/v0.9.5/bin:/usr/local/bin:$NVM_DIR/v0.2.5/bin:$NVM_DIR/versions/node/v0.12.0/bin:$NVM_DIR/versions/io.js/v1.0.0/bin STRIPPED_PATH=`nvm_strip_path "$TEST_PATH" "/bin"`