Skip to content

Commit 9f4a32b

Browse files
committed
macOS上检测磁盘是否不足时忽略/Developer/相关分区
1 parent 2565b10 commit 9f4a32b

File tree

1 file changed

+9
-0
lines changed
  • internal/web/actions/default/dashboard/dashboardutils

1 file changed

+9
-0
lines changed

internal/web/actions/default/dashboard/dashboardutils/utils.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"os/exec"
2020
"regexp"
2121
"runtime"
22+
"strings"
2223
)
2324

2425
// CheckDiskPartitions 检查服务器磁盘空间
@@ -47,6 +48,14 @@ func CheckDiskPartitions(thresholdPercent float64) (path string, usage uint64, u
4748
if p.Fstype != rootFS {
4849
continue
4950
}
51+
52+
// skip some specified partitions on macOS
53+
if runtime.GOOS == "darwin" {
54+
if strings.Contains(p.Mountpoint, "/Developer/") {
55+
continue
56+
}
57+
}
58+
5059
stat, _ := disk.Usage(p.Mountpoint)
5160
if stat != nil {
5261
if stat.Used < 2*uint64(sizes.G) {

0 commit comments

Comments
 (0)