summaryrefslogtreecommitdiff
path: root/gitstatus.plugin.sh
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2022-01-26 16:45:50 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2022-01-26 16:45:50 +0300
commit5014de0541201716dc4ee6f544321ac4e3d7431e (patch)
tree9bcb02b18cd6292560921e51d31e3bb3fd21ba6b /gitstatus.plugin.sh
parentc8160f29543a2f57ae7149103deefa029fd4e861 (diff)
Squashed 'gitstatus/' changes from e02d9eed..6eb490ab
6eb490ab survive broken $TMPDIR 94bf4fc2 add ppc64 support to the build script git-subtree-dir: gitstatus git-subtree-split: 6eb490ab86118ad063224e4d50b6b05bea7dd12c
Diffstat (limited to 'gitstatus.plugin.sh')
-rw-r--r--gitstatus.plugin.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/gitstatus.plugin.sh b/gitstatus.plugin.sh
index 0c660967..37b78f44 100644
--- a/gitstatus.plugin.sh
+++ b/gitstatus.plugin.sh
@@ -121,7 +121,12 @@ function gitstatus_start() {
--repo-ttl-seconds="$ttl"
$extra_flags)
- tmpdir="$(command mktemp -d "${TMPDIR:-/tmp}"/gitstatus.bash.$$.XXXXXXXXXX)" || return
+ if [[ -n "$TMPDIR" && ( ( -d "$TMPDIR" && -w "$TMPDIR" ) || ! ( -d /tmp && -w /tmp ) ) ]]; then
+ local tmpdir=$TMPDIR
+ else
+ local tmpdir=/tmp
+ fi
+ tmpdir="$(command mktemp -d "$tmpdir"/gitstatus.bash.$$.XXXXXXXXXX)" || return
if [[ -n "$log_level" ]]; then
GITSTATUS_DAEMON_LOG="$tmpdir"/daemon.log