-
-
Notifications
You must be signed in to change notification settings - Fork 8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Fix] add missing "command" prefix call for the commands #1296
Conversation
6f9dea9
to
3c61756
Compare
A number of these are intentional as it caused problems in some shells. I'd prefer to wait until there are specific bug reports, as aliasing over builtin commands is a very bad practice, and as such, isn't super common. |
@ljharb how do we determinate if it's intentional or not? I believe at least many of these should be fixed as there are not only one usage but both with and without |
Fair question. Certainly if I've prefixed a |
Any idea about how we could do on this PR? Just prefix the commands have been prefixed before and don't touch the others until bug report? Actually, I only prefix the non-builtin commands, is this good enough? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've commented on the things that should be reverted; the rest look great and are likely just omissions on my part.
@@ -49,7 +49,7 @@ nvm_node_version() { | |||
|
|||
nvm_download() { | |||
if nvm_has "curl"; then | |||
curl -q "$@" | |||
command curl -q "$@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one i think should be reverted; sometimes people alias curl intentionally
@@ -231,7 +231,7 @@ nvm_check_global_modules() { | |||
|
|||
local NPM_GLOBAL_MODULES | |||
NPM_GLOBAL_MODULES="$( | |||
npm list -g --depth=0 | | |||
command npm list -g --depth=0 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's revert this since it hasn't been a problem before
@@ -240,7 +240,7 @@ nvm_check_global_modules() { | |||
MODULE_COUNT="$( | |||
command printf %s\\n "$NPM_GLOBAL_MODULES" | | |||
command sed -ne '1!p' | # Remove the first line | |||
wc -l | tr -d ' ' # Count entries | |||
command wc -l | tr -d ' ' # Count entries |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's revert this since it hasn't been a problem before (note that tr
isn't prefixed either)
@@ -1,6 +1,6 @@ | |||
#!/usr/bin/env bash | |||
|
|||
DIR="$(command cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |||
DIR="$(command cd "$( command dirname "${BASH_SOURCE[0]}" )" && pwd )" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's revert this since it hasn't been a problem before
@@ -603,7 +603,7 @@ nvm_make_alias() { | |||
nvm_err "an alias target version is required" | |||
return 2 | |||
fi | |||
nvm_echo "${VERSION}" | tee "$(nvm_alias_path)/${ALIAS}" >/dev/null | |||
nvm_echo "${VERSION}" | command tee "$(nvm_alias_path)/${ALIAS}" >/dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's revert this since it hasn't been a problem before
@@ -1364,7 +1364,7 @@ nvm_print_implicit_alias() { | |||
NVM_IOJS_VERSION="$($NVM_COMMAND)" &&: | |||
EXIT_CODE="$?" | |||
if [ "_$EXIT_CODE" = "_0" ]; then | |||
NVM_IOJS_VERSION="$(nvm_echo "$NVM_IOJS_VERSION" | command sed "s/^$NVM_IMPLICIT-//" | nvm_grep -e '^v' | command cut -c2- | command cut -d . -f 1,2 | uniq | command tail -1)" | |||
NVM_IOJS_VERSION="$(nvm_echo "$NVM_IOJS_VERSION" | command sed "s/^$NVM_IMPLICIT-//" | nvm_grep -e '^v' | command cut -c2- | command cut -d . -f 1,2 | command uniq | command tail -1)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's revert this since it hasn't been a problem before
@@ -1394,7 +1394,7 @@ nvm_print_implicit_alias() { | |||
setopt shwordsplit | |||
fi | |||
|
|||
LAST_TWO=$($NVM_COMMAND | nvm_grep -e '^v' | command cut -c2- | command cut -d . -f 1,2 | uniq) | |||
LAST_TWO=$($NVM_COMMAND | nvm_grep -e '^v' | command cut -c2- | command cut -d . -f 1,2 | command uniq) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's revert this since it hasn't been a problem before
@@ -1775,9 +1775,9 @@ nvm_get_make_jobs() { | |||
elif [ "_$NVM_OS" = "_freebsd" ] || [ "_$NVM_OS" = "_darwin" ]; then | |||
NVM_CPU_THREADS="$(sysctl -n hw.ncpu)" | |||
elif [ "_$NVM_OS" = "_sunos" ]; then | |||
NVM_CPU_THREADS="$(psrinfo | wc -l)" | |||
NVM_CPU_THREADS="$(psrinfo | command wc -l)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's revert this since it hasn't been a problem before
@@ -1886,10 +1886,10 @@ nvm_install_source() { | |||
if nvm_version_greater 0.2.3 "$VERSION"; then | |||
nvm_err 'npm requires node v0.2.3 or higher' | |||
else | |||
nvm_download -L https://npmjs.org/install.sh -o - | clean=yes npm_install=0.2.19 sh | |||
nvm_download -L https://npmjs.org/install.sh -o - | clean=yes npm_install=0.2.19 command sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's revert this since it hasn't been a problem before
fi | ||
else | ||
nvm_download -L https://npmjs.org/install.sh -o - | clean=yes sh | ||
nvm_download -L https://npmjs.org/install.sh -o - | clean=yes command sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's revert this since it hasn't been a problem before
@ljharb sorry but I just didn't understand, do we really need to wait for the problem occurs even we can prevent it? We never know if there would be a guy that write his/her own |
It's a reasonable thing to do - and if |
3c61756
to
eab41ed
Compare
Updated! |
No description provided.