mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-07-10 05:41:18 +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)
|
local _RUNTIME_FILE=$(umask 7077; mktemp /tmp/zsh_runtime.$$.XXXXXX)
|
||||||
|
|
||||||
function runtime() {
|
function runtime() {
|
||||||
local last=$(cat ${_RUNTIME_FILE})
|
local last=$(cat ${_RUNTIME_FILE} 2>/dev/null)
|
||||||
if [[ -n $last ]]; then
|
if [[ -n $last ]]; then
|
||||||
echo "$(date '+%s')-$last" | bc -ql
|
echo "$(date '+%s')-$last" | bc -ql
|
||||||
echo > ${_RUNTIME_FILE}
|
echo > ${_RUNTIME_FILE}
|
||||||
|
|
@ -18,7 +18,7 @@ function runtime_preexec() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function runtime_zshexit() {
|
function runtime_zshexit() {
|
||||||
rm ${_RUNTIME_FILE}
|
rm -f ${_RUNTIME_FILE}
|
||||||
}
|
}
|
||||||
|
|
||||||
autoload -U add-zsh-hook
|
autoload -U add-zsh-hook
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue