Skip to content

statusline-command.sh uses macOS-only stat syntax (breaks on Linux) #227

@noxx

Description

@noxx

The statusline script uses stat -f%m which is macOS syntax. On Linux, this fails silently and breaks the ccusage cache timing.

Location: statusline-command.sh lines 117 and 165

Current (macOS only):
cache_age=$(($(date +%s) - $(stat -f%m "$CACHE_FILE" 2>/dev/null || echo 0)))

Fix (cross-platform):
cache_age=$(($(date +%s) - $(stat -c%Y "$CACHE_FILE" 2>/dev/null || stat -f%m "$CACHE_FILE" 2>/dev/null || echo 0)))

Tries Linux syntax first (-c%Y), falls back to macOS (-f%m).

My PAI caught this during a PAI health check and applied the fix locally. Sharing in case others hit the same issue on Linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions