]> Sergey Matveev's repositories - zsh-autoenv.git/commitdiff
Handle failure of loading zsh/stat
authorDaniel Hahler <git@thequod.de>
Thu, 18 Dec 2014 18:45:48 +0000 (19:45 +0100)
committerDaniel Hahler <git@thequod.de>
Thu, 18 Dec 2014 18:45:48 +0000 (19:45 +0100)
autoenv.zsh

index 14c4a7a2e114277d0e23eb88e56165047e7c0c9b..e501f901cef9251da95e7094e5341bd434d2ddb3 100644 (file)
@@ -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).