From d6f8c477617d57363d0e2c28977ef815e5a675a2 Mon Sep 17 00:00:00 2001 From: Roman Perepelitsa Date: Wed, 26 Jan 2022 15:03:22 +0100 Subject: survive broken $TMPDIR --- internal/worker.zsh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'internal/worker.zsh') 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