summaryrefslogtreecommitdiff
path: root/internal/worker.zsh
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2022-01-26 17:03:22 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2022-01-26 17:03:22 +0300
commitd6f8c477617d57363d0e2c28977ef815e5a675a2 (patch)
tree6153b11e7fe18a864c895669bcf316f83c1e9391 /internal/worker.zsh
parentcead0349c57f27521b8307b4651a5c077e6bb276 (diff)
survive broken $TMPDIR
Diffstat (limited to 'internal/worker.zsh')
-rw-r--r--internal/worker.zsh8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/worker.zsh b/internal/worker.zsh
index 8eb21af3..269e8aad 100644
--- a/internal/worker.zsh
+++ b/internal/worker.zsh
@@ -181,7 +181,13 @@ function _p9k_worker_start() {
setopt monitor || return
{
[[ -n $_p9k__worker_resp_fd ]] && return
- _p9k__worker_file_prefix=${TMPDIR:-/tmp}/p10k.worker.$EUID.$sysparams[pid].$EPOCHSECONDS
+
+ if [[ -n "$TMPDIR" && ( ( -d "$TMPDIR" && -w "$TMPDIR" ) || ! ( -d /tmp && -w /tmp ) ) ]]; then
+ local tmpdir=$TMPDIR
+ else
+ local tmpdir=/tmp
+ fi
+ _p9k__worker_file_prefix=$tmpdir/p10k.worker.$EUID.$sysparams[pid].$EPOCHSECONDS
sysopen -r -o cloexec -u _p9k__worker_resp_fd <(
exec 0</dev/null