aboutsummaryrefslogtreecommitdiff
path: root/gitstatus.plugin.sh
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.sh
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.sh')
-rw-r--r--gitstatus.plugin.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/gitstatus.plugin.sh b/gitstatus.plugin.sh
index 1ecccb85..2fe322ef 100644
--- a/gitstatus.plugin.sh
+++ b/gitstatus.plugin.sh
@@ -146,8 +146,18 @@ function gitstatus_start() {
local sig=(TERM ILL PIPE)
+ if (( UID == EUID )); then
+ local home=~
+ else
+ local user
+ user="$(command id -un)" || return
+ [[ "$user" =~ ^[a-zA-Z0-9_,.-]+$ ]] || return
+ eval "local home=~$user"
+ [[ -n "$home" ]] || return
+ fi
+
if [[ -x "$_gitstatus_bash_daemon" ]]; then
- "$_gitstatus_bash_daemon" \
+ HOME="$home" "$_gitstatus_bash_daemon" \
-G "$_gitstatus_bash_version" "${daemon_args[@]}" <&"$fd_in" >&"$fd_out" &
local pid=$!
trap "trap - ${sig[*]}; kill $pid &>/dev/null" ${sig[@]}
@@ -176,7 +186,7 @@ function gitstatus_start() {
[[ -n "$_gitstatus_bash_version" ]] || return
[[ "$_gitstatus_bash_downloaded" == 1 ]] || return
- "$_gitstatus_bash_daemon" \
+ HOME="$home" "$_gitstatus_bash_daemon" \
-G "$_gitstatus_bash_version" "${daemon_args[@]}" <&"$fd_in" >&"$fd_out" &
local pid=$!
trap "trap - ${sig[*]}; kill $pid &>/dev/null" ${sig[@]}