aboutsummaryrefslogtreecommitdiff
path: root/internal/wizard.zsh
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2022-11-27 17:37:04 +0300
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2022-11-27 17:37:04 +0300
commit8d47270e8c17672e9323373e4df3699cb43545ff (patch)
treeec2fa06fab65e149ceea56aacbef700006cc2f38 /internal/wizard.zsh
parent176f781121c02af7c504746619eab910a457e935 (diff)
don't invoke mktemp if it doesn't exist
Diffstat (limited to 'internal/wizard.zsh')
-rw-r--r--internal/wizard.zsh9
1 files changed, 6 insertions, 3 deletions
diff --git a/internal/wizard.zsh b/internal/wizard.zsh
index 7b6de601..e8a7c1b1 100644
--- a/internal/wizard.zsh
+++ b/internal/wizard.zsh
@@ -1565,8 +1565,11 @@ function ask_config_overwrite() {
local tmpdir=/tmp
local tmpdir_u=/tmp
fi
- config_backup="$(mktemp $tmpdir/$__p9k_cfg_basename.XXXXXXXXXX)" || quit -c
- cp $__p9k_cfg_path $config_backup || quit -c
+ if (( ! $+commands[mktemp] )) ||
+ ! config_backup=$(mktemp $tmpdir/$__p9k_cfg_basename.XXXXXXXXXX 2>/dev/null); then
+ config_backup=$tmpdir/$__p9k_cfg_basename.$EPOCHREALTIME
+ fi
+ cp $__p9k_cfg_path $config_backup || quit -c
config_backup_u=$tmpdir_u/${(q-)config_backup:t}
;;
esac
@@ -2023,7 +2026,7 @@ else
_p9k_can_configure -q || return
fi
-zmodload zsh/terminfo || return
+zmodload zsh/terminfo zsh/datetime || return
if [[ $ZSH_VERSION == (5.7.<1->*|5.<8->*|<6->.*) && $COLORTERM == (24bit|truecolor) ]]; then
local -ir has_truecolor=1