Repository navigation
Commit 9449392
fix: enable nullglob to avoid glob expansion errors when no node versions installed
Fixes nvm-sh#3727
When no node versions are installed, nvm ls produces errors like:
`find: /path/.nvm/versions/node/*: No such file or directory`
This happens because bash expands `*` literally when nullglob is not
set and the directory is empty.
Solution:
- For bash: temporarily enable nullglob before the find command
- For other shells (sh, dash, zsh): suppress stderr (2>/dev/null)
- Restore nullglob to its previous state after the command completes
- Uses BASH_VERSION check to detect bash vs other shells1 parent 630a01f commit 9449392
1 file changed
Lines changed: 19 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1532 | 1532 | | |
1533 | 1533 | | |
1534 | 1534 | | |
1535 | | - | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
| 1540 | + | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
1536 | 1549 | | |
1537 | 1550 | | |
1538 | 1551 | | |
| |||
1547 | 1560 | | |
1548 | 1561 | | |
1549 | 1562 | | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
1550 | 1568 | | |
1551 | 1569 | | |
1552 | 1570 | | |
| |||
0 commit comments