mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-06-05 05:03:16 +02:00
[plugins/runtime] Hide error due to race conditions when the tmp file has been deleted
Signed-off-by: Olivier Mehani <olivier.mehani@learnosity.com>
This commit is contained in:
parent
07f4f79779
commit
e528bd5b33
1 changed files with 2 additions and 2 deletions
|
|
@ -6,7 +6,7 @@
|
|||
local _RUNTIME_FILE=$(umask 7077; mktemp /tmp/zsh_runtime.$$.XXXXXX)
|
||||
|
||||
function runtime() {
|
||||
local last=$(cat ${_RUNTIME_FILE})
|
||||
local last=$(cat ${_RUNTIME_FILE} 2>/dev/null)
|
||||
if [[ -n $last ]]; then
|
||||
echo "$(date '+%s')-$last" | bc -ql
|
||||
echo > ${_RUNTIME_FILE}
|
||||
|
|
@ -18,7 +18,7 @@ function runtime_preexec() {
|
|||
}
|
||||
|
||||
function runtime_zshexit() {
|
||||
rm ${_RUNTIME_FILE}
|
||||
rm -f ${_RUNTIME_FILE}
|
||||
}
|
||||
|
||||
autoload -U add-zsh-hook
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue