zsh_reload: use exec zsh instead of source ~/.zshrc

`source ~/.zshrc` is a bad practice, it doesn't make sure that the full
zsh session is reloaded and it may have side effects.

Use `$SHELL` as the path to zsh if it exists (this will fix edge cases
where the zsh used is not the first on $PATH). Otherwise, use `zsh`.
This commit is contained in:
Marc Cornellà 2016-10-26 20:05:57 +02:00
parent 8706c8eb64
commit 405b8f220a

View File

@ -7,5 +7,6 @@ src() {
zrecompile -p $f && command rm -f $f.zwc.old
done
source ~/.zshrc
# Use $SHELL if available; remove leading dash if login shell
[[ -n "$SHELL" ]] && exec ${SHELL#-} || exec zsh
}