Skip to content
Myr

Guarding npm version printing with NVM_SILENT flag check; when sourcing nvm.sh, a considerable amount of time is spent running npm --version only for that output to be black-holed to /dev/null

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Alan Quach · committed by Alan Quach · parent f2d31b0 · Browse files · 1 file+3 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+3 added−1 removed

  • other:+3 added−1 removed

1 file+3 added−1 removed

modified:nvm.sh+3 added-1 removed
59 unmodified lines
60 [ "$(nvm deactivate >/dev/null 2>&1 && command -v iojs)" != '' ]61}6263nvm_print_npm_version() {64 if nvm_has "npm"; then64 if [ "$NVM_SILENT" != "true" ] && nvm_has "npm"; then65 echo " (npm v$(npm --version 2>/dev/null))"66 fi67}68
1812 unmodified lines
1881 elif nvm_rc_version >/dev/null 2>&1; then1882 nvm install >/dev/null1883 fi1884elif [ -n "$VERSION" ]; then1885 NVM_SILENT="true"1886 nvm use "$VERSION" >/dev/null1887 unset NVM_SILENT1888elif nvm_rc_version >/dev/null 2>&1; then1889 nvm use >/dev/null1890fi1891
1 unmodified line