Mole
Mole copied to clipboard
[BUG] app_caches.sh: line 79: [[: 0 0: syntax error in expression (error token is "0")
Describe the bug
When I run the mo clean command I get the following error:
✓ Xcode unavailable simulators · already clean
/Users/NAMEUSER/.config/mole/bin/../lib/clean/app_caches.sh: line 79: [[: 0
0: syntax error in expression (error token is "0")
Version
Channel: Nightly (49b156a)
Hey, found it! Snuck in with #714 (fb41fa2). grep -c prints 0 on no matches and exits with code 1, so || echo "0" fires too — leaving unavail_count as 0\n0, which breaks the [[ -gt 0 ]] comparison.
Fix is just borrowing the pattern dev.sh already uses:
unavail_count=$(xcrun simctl list devices unavailable 2>/dev/null | awk '/\([0-9A-F-]{36}\)/ {c++} END {print c+0}')
[[ "$unavail_count" =~ ^[0-9]+$ ]] || unavail_count=0
Happy to open a PR if that helps!