mirror of
https://github.com/nvm-sh/nvm.git
synced 2025-05-10 22:31:51 +00:00
cd now returns the original exit code.
This commit is contained in:
parent
796b7153d4
commit
2308db150e
@ -386,13 +386,17 @@ Put this into your `$HOME/.bashrc` to call `nvm use` automatically whenever you
|
|||||||
```bash
|
```bash
|
||||||
# place this after nvm initialization!
|
# place this after nvm initialization!
|
||||||
cd() {
|
cd() {
|
||||||
if [ -z "$1" ]
|
if [ -z "$1" ]
|
||||||
then
|
then
|
||||||
builtin cd
|
builtin cd
|
||||||
else
|
else
|
||||||
builtin cd $1
|
builtin cd $1
|
||||||
fi
|
fi
|
||||||
|
CD_EXIT_CODE=$?
|
||||||
|
|
||||||
[ -f ".nvmrc" ] && [ -s ".nvmrc" ] && nvm use
|
[ -f ".nvmrc" ] && [ -s ".nvmrc" ] && nvm use
|
||||||
|
|
||||||
|
exit $CD_EXIT_CODE
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user