[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:
Olivier Mehani 2018-05-11 10:22:27 +10:00
commit e528bd5b33
No known key found for this signature in database
GPG key ID: E9566B9D0957D2D3

View file

@ -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