fix: use portable file timestamp comparison in fish brew cache check

Replace fish's `-nt` test operator (not available in fish) with explicit stat-based timestamp comparison for cross-shell compatibility.
This commit is contained in:
Ryan Walters
2025-11-07 11:35:10 -06:00
parent 26f332e1a4
commit 262da2f114

View File

@@ -46,7 +46,7 @@ if test -f /home/linuxbrew/.linuxbrew/bin/brew
# Regenerate cache if: doesn't exist, >7 days old, or brew binary is newer
if not test -f "$brew_cache"; \
or test (math (date +%s) - (stat -c %Y "$brew_cache" 2>/dev/null || echo 0)) -gt 604800; \
or test "$brew_bin" -nt "$brew_cache"
or test (stat -c %Y "$brew_bin" 2>/dev/null || echo 0) -gt (stat -c %Y "$brew_cache" 2>/dev/null || echo 0)
mkdir -p (dirname "$brew_cache")
$brew_bin shellenv > "$brew_cache" 2>/dev/null
end