b876198575cbf23d589ddc8da6b22254d3d5358b

Author
Marc Cornellà <marc.cornella@live.com>
Committer
Marc Cornellà <marc.cornella@live.com>
Date

Message

init: silence zcompdump metadata write for invalid ZSH_COMPDUMP filenames

If `$SHORT_HOST` contains invalid filename characters, the compinit call doesn't
error, but the zcompdump metadata write does. Use `tee` instead so we can silence
the error.

See https://github.com/ohmyzsh/ohmyzsh/commit/dd1a72696f162fd5285a104b5f63970deb66e8b0#commitcomment-38984764

Diff

 1diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
 2index 285caf6686d741b3899109dda33840d508f7bda7..6c61725cdcf897ef9f860c19f66d1687e7f0da97 100644
 3--- a/oh-my-zsh.sh
 4+++ b/oh-my-zsh.sh
 5@@ -86,7 +86,7 @@ fi
 6 
 7 # Append zcompdump metadata if missing
 8 if (( $zcompdump_refresh )); then
 9-  echo "\n$zcompdump_metadata" >>! "$ZSH_COMPDUMP"
10+  echo "\n$zcompdump_metadata" | tee -a "$ZSH_COMPDUMP" &>/dev/null
11 fi
12 
13 unset zcompdump_metadata zcompdump_refresh