aboutsummaryrefslogtreecommitdiff
path: root/gitstatus/gitstatus.plugin.zsh
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2020-06-13 12:15:44 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2020-06-13 12:15:44 +0300
commit4d14f9e0ba94770c55b28c2839c71dda47f97d9c (patch)
tree95f588831e52a0eaa61c8d98a19e3c03e44ffd34 /gitstatus/gitstatus.plugin.zsh
parentfaa510d54c30b9384ee7f4a95b9d04f5c6a8cf62 (diff)
parentb0158178925484c058e6175e174b639237532c63 (diff)
Merge commit 'b0158178925484c058e6175e174b639237532c63'
Diffstat (limited to 'gitstatus/gitstatus.plugin.zsh')
-rw-r--r--gitstatus/gitstatus.plugin.zsh13
1 files changed, 11 insertions, 2 deletions
diff --git a/gitstatus/gitstatus.plugin.zsh b/gitstatus/gitstatus.plugin.zsh
index cc6662a7..0df36724 100644
--- a/gitstatus/gitstatus.plugin.zsh
+++ b/gitstatus/gitstatus.plugin.zsh
@@ -406,8 +406,17 @@ function _gitstatus_daemon"${1:-}"() {
[[ -n $_gitstatus_zsh_version ]] || return
[[ $_gitstatus_zsh_downloaded == [01] ]] || return
+ if (( UID == EUID )); then
+ local home=~
+ else
+ local user
+ user="$(command id -un)" || return
+ local home=${userdirs[$user]}
+ [[ -n $home ]] || return
+ fi
+
if [[ -x $_gitstatus_zsh_daemon ]]; then
- $_gitstatus_zsh_daemon -G $_gitstatus_zsh_version "${(@)args}" >&$pipe_fd
+ HOME=$home $_gitstatus_zsh_daemon -G $_gitstatus_zsh_version "${(@)args}" >&$pipe_fd
local -i ret=$?
[[ $ret == (0|129|130|131|137|141|143) ]] && return ret
fi
@@ -426,7 +435,7 @@ function _gitstatus_daemon"${1:-}"() {
[[ -n $_gitstatus_zsh_version ]] || return
[[ $_gitstatus_zsh_downloaded == 1 ]] || return
- $_gitstatus_zsh_daemon -G $_gitstatus_zsh_version "${(@)args}" >&$pipe_fd
+ HOME=$home $_gitstatus_zsh_daemon -G $_gitstatus_zsh_version "${(@)args}" >&$pipe_fd
} always {
local -i ret=$?
zf_rm -f -- $file_prefix.lock $file_prefix.fifo