From e528bd5b335adb1f05347e78571a15f183b981f2 Mon Sep 17 00:00:00 2001 From: Olivier Mehani Date: Fri, 11 May 2018 10:22:27 +1000 Subject: [PATCH] [plugins/runtime] Hide error due to race conditions when the tmp file has been deleted Signed-off-by: Olivier Mehani --- plugins/runtime/runtime.plugin.zsh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/runtime/runtime.plugin.zsh b/plugins/runtime/runtime.plugin.zsh index ef497e6d9..bae49150e 100644 --- a/plugins/runtime/runtime.plugin.zsh +++ b/plugins/runtime/runtime.plugin.zsh @@ -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