about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Unix/Command/_npm9
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 5bccfa75b..26068c16d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-11-13  dana  <dana@dana.is>
 
+	* 43809: Completion/Unix/Command/_npm: Suppress npm update checks
+	during completion
+
 	* unposted (cf. 43800): Completion/Zsh/Command/_strftime: Update
 	strftime completion for nanoseconds change
 
diff --git a/Completion/Unix/Command/_npm b/Completion/Unix/Command/_npm
index f5493a321..c05f61c51 100644
--- a/Completion/Unix/Command/_npm
+++ b/Completion/Unix/Command/_npm
@@ -2,8 +2,13 @@
 
 # Node Package Manager completion, letting npm do all the completion work
 
-if type npm > /dev/null; then
-  eval "$(npm completion)"
+if (( $+commands[npm] )); then
+  eval "$(NPM_CONFIG_UPDATE_NOTIFIER=false npm completion)"
+  # Monkey-patch their function to prevent update checks
+  functions[_npm_completion]="
+    local -x NPM_CONFIG_UPDATE_NOTIFIER=false;
+    ${functions[_npm_completion]}
+  "
 
   _npm_completion "$@"
 fi