ac9a8cb687958d1caf05e69bc7aa5f4297383c09
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
Merge branch 'fix/cached-npm-completion'
Fixes #5332
Diff
1diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh
2index 30b91ec9c81dc6791b8f391c78f0333083fec6bf..02e4f3e93f0deffbcf4ffbd93a045c294974d830 100644
3--- a/plugins/npm/npm.plugin.zsh
4+++ b/plugins/npm/npm.plugin.zsh
5@@ -2,10 +2,13 @@
6 __NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion"
7
8 if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
9- npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE
10+ npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null
11+ [[ $? -ne 0 ]] && rm -f $__NPM_COMPLETION_FILE
12 fi
13
14- source $__NPM_COMPLETION_FILE
15+ [[ -f $__NPM_COMPLETION_FILE ]] && source $__NPM_COMPLETION_FILE
16+
17+ unset __NPM_COMPLETION_FILE
18 }
19
20 # Install dependencies globally