summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2016-09-10 00:24:46 +0200
committerMarc Cornellà <marc.cornella@live.com>2016-09-10 00:24:46 +0200
commitac9a8cb687958d1caf05e69bc7aa5f4297383c09 (patch)
tree845736a086eff85cb4c6a584c8264f13345314f6
parent27fff27253ec7f631f3f9e51f0a9f37214d67f17 (diff)
parentb70842bae4346c793e4932d467dd566baeee7d64 (diff)
downloadzsh-ac9a8cb687958d1caf05e69bc7aa5f4297383c09.tar.gz
zsh-ac9a8cb687958d1caf05e69bc7aa5f4297383c09.tar.bz2
zsh-ac9a8cb687958d1caf05e69bc7aa5f4297383c09.zip
Merge branch 'fix/cached-npm-completion'
Fixes #5332
-rw-r--r--plugins/npm/npm.plugin.zsh7
1 files changed, 5 insertions, 2 deletions
diff --git a/plugins/npm/npm.plugin.zsh b/plugins/npm/npm.plugin.zsh
index 30b91ec9c..02e4f3e93 100644
--- a/plugins/npm/npm.plugin.zsh
+++ b/plugins/npm/npm.plugin.zsh
@@ -2,10 +2,13 @@
__NPM_COMPLETION_FILE="${ZSH_CACHE_DIR}/npm_completion"
if [[ ! -f $__NPM_COMPLETION_FILE ]]; then
- npm completion >! $__NPM_COMPLETION_FILE || rm -f $__NPM_COMPLETION_FILE
+ npm completion >! $__NPM_COMPLETION_FILE 2>/dev/null
+ [[ $? -ne 0 ]] && rm -f $__NPM_COMPLETION_FILE
fi
- source $__NPM_COMPLETION_FILE
+ [[ -f $__NPM_COMPLETION_FILE ]] && source $__NPM_COMPLETION_FILE
+
+ unset __NPM_COMPLETION_FILE
}
# Install dependencies globally