summaryrefslogtreecommitdiff
path: root/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
commitb0158178925484c058e6175e174b639237532c63 (patch)
treef981d2d715e6ef7de67c2dab6f3195fd7fa46341 /gitstatus.plugin.zsh
parentfa2e337cbdd88ccd297d25fa9847225211801d3e (diff)
Squashed 'gitstatus/' changes from 38d62a47..1c74c8db
1c74c8db add linux-ppc64le 968779b5 fix tar invocation 300f657c create anonymous tar archives a5581d18 force C locale during build (perl complains) 2616cd47 support downloads to usrbin 1e6075dd enable static linking on linux 2975d25f update libgit2 ref bea6f868 add ppc64le target git-subtree-dir: gitstatus git-subtree-split: 1c74c8db0f422aa6f95ced878351e0c6944a9bd6
Diffstat (limited to 'gitstatus.plugin.zsh')
-rw-r--r--gitstatus.plugin.zsh13
1 files changed, 11 insertions, 2 deletions
diff --git a/gitstatus.plugin.zsh b/gitstatus.plugin.zsh
index cc6662a7..0df36724 100644
--- a/gitstatus.plugin.zsh
+++ b/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