From 936b5eaf7798740d0008a48949da2e02bc4e26d3 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 18 Dec 2014 19:45:48 +0100 Subject: [PATCH] Handle failure of loading zsh/stat --- autoenv.zsh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/autoenv.zsh b/autoenv.zsh index 14c4a7a..e501f90 100644 --- a/autoenv.zsh +++ b/autoenv.zsh @@ -122,7 +122,14 @@ _autoenv_debug() { # }}} # Load zstat module, but only its builtin `zstat`. -zmodload -F zsh/stat b:zstat +if ! zmodload -F zsh/stat b:zstat 2>/dev/null; then + # If the module is not available, define a wrapper around `stat`, and use its + # terse output instead of format, which is not supported by busybox. + # Assume '+mtime' as $1. + zstat() { + stat -t $2 | cut -f13 -d ' ' + } +fi # Generate hash pair for a given file ($1).