mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	macOS上检测磁盘是否不足时忽略/Developer/相关分区
This commit is contained in:
		@@ -19,6 +19,7 @@ import (
 | 
			
		||||
	"os/exec"
 | 
			
		||||
	"regexp"
 | 
			
		||||
	"runtime"
 | 
			
		||||
	"strings"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// CheckDiskPartitions 检查服务器磁盘空间
 | 
			
		||||
@@ -47,6 +48,14 @@ func CheckDiskPartitions(thresholdPercent float64) (path string, usage uint64, u
 | 
			
		||||
		if p.Fstype != rootFS {
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// skip some specified partitions on macOS
 | 
			
		||||
		if runtime.GOOS == "darwin" {
 | 
			
		||||
			if strings.Contains(p.Mountpoint, "/Developer/") {
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		stat, _ := disk.Usage(p.Mountpoint)
 | 
			
		||||
		if stat != nil {
 | 
			
		||||
			if stat.Used < 2*uint64(sizes.G) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user