diff options
author | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2022-11-28 14:14:48 +0300 |
---|---|---|
committer | Roman Perepelitsa <roman.perepelitsa@gmail.com> | 2022-11-28 14:14:48 +0300 |
commit | 6609767abd81aed3101cb67908df727998b0b619 (patch) | |
tree | 8ebd5e6cfccb62baec64eb47ce7dddb415fbbce2 | |
parent | 8d47270e8c17672e9323373e4df3699cb43545ff (diff) |
don't invoke mktemp if it doesn't exist
-rw-r--r-- | internal/wizard.zsh | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/internal/wizard.zsh b/internal/wizard.zsh index e8a7c1b1..f93fd0a3 100644 --- a/internal/wizard.zsh +++ b/internal/wizard.zsh @@ -1638,7 +1638,10 @@ function ask_zshrc_edit() { local tmpdir=/tmp local tmpdir_u=/tmp fi - zshrc_backup="$(mktemp $tmpdir/.zshrc.XXXXXXXXXX)" || quit -c + if (( ! $+commands[mktemp] )) || + ! zshrc_backup="$(mktemp $tmpdir/.zshrc.XXXXXXXXXX 2>/dev/null)"; then + zshrc_backup=$tmpdir/.zshrc.$EPOCHREALTIME + fi cp -p $__p9k_zshrc $zshrc_backup || quit -c local -i writable=1 if [[ ! -w $zshrc_backup ]]; then |