[Robustness] add `command` to `xargs`/`rm` in `nvm_get_default_packages`

Fixes #2281.
Jordan Harband 2020-08-11 10:16:42 -07:00
parent 1bf567bd0b
commit 16b75b7333
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
1 changed files with 2 additions and 2 deletions

4
nvm.sh
View File

@ -3661,7 +3661,7 @@ nvm_get_default_packages() {
# ensure a trailing newline
WORK=$(mktemp -d) || exit $?
# shellcheck disable=SC2064
trap "rm -rf '$WORK'" EXIT
trap "command rm -rf '$WORK'" EXIT
# shellcheck disable=SC1003
sed -e '$a\' "${NVM_DEFAULT_PACKAGE_FILE}" > "${WORK}/default-packages"
while IFS=' ' read -r line; do
@ -3681,7 +3681,7 @@ nvm_get_default_packages() {
DEFAULT_PACKAGES="${DEFAULT_PACKAGES}${line} "
done < "${WORK}/default-packages"
echo "${DEFAULT_PACKAGES}" | xargs
echo "${DEFAULT_PACKAGES}" | command xargs
fi
}