aboutsummaryrefslogtreecommitdiff
path: root/gitstatus/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
commit4d14f9e0ba94770c55b28c2839c71dda47f97d9c (patch)
tree95f588831e52a0eaa61c8d98a19e3c03e44ffd34 /gitstatus/gitstatus.plugin.sh
parentfaa510d54c30b9384ee7f4a95b9d04f5c6a8cf62 (diff)
parentb0158178925484c058e6175e174b639237532c63 (diff)
Merge commit 'b0158178925484c058e6175e174b639237532c63'
Diffstat (limited to 'gitstatus/gitstatus.plugin.sh')
-rw-r--r--gitstatus/gitstatus.plugin.sh14
1 files changed, 12 insertions, 2 deletions
diff --git a/gitstatus/gitstatus.plugin.sh b/gitstatus/gitstatus.plugin.sh
index 1ecccb85..2fe322ef 100644
--- a/gitstatus/gitstatus.plugin.sh
+++ b/gitstatus/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[@]}