-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix symlink traversal
- Loading branch information
Showing
2 changed files
with
20 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
test/slow/nvm exec/Running "nvm exec --lts" when NVM_DIR differs from nvm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
set -ex | ||
|
||
die () { echo "$@" ; exit 1; } | ||
|
||
INSTPATH="$(mktemp -p "$(pwd)" -d)" | ||
trap 'test ! -z "${INSTPATH-}" && test -d "$INSTPATH" && rm -rf "$INSTPATH"' EXIT | ||
declare -x NVM_DIR=$INSTPATH | ||
\. ../../../nvm.sh | ||
|
||
nvm install --lts || die 'nvm install --lts failed' | ||
nvm exec --lts npm --version || die "`nvm exec` failed to run" | ||
declare -x NODE_VERSION="$(nvm exec --lts --silent node --version)" | ||
|
||
ln -s ../../../../nvm-exec "$INSTPATH/nvm-exec" || die "failed to create a symlink to $INSTPATH/" | ||
"$INSTPATH/nvm-exec" npm ls > /dev/null || die "`nvm exec` failed to run using nvm-exec helper" | ||
|