fix(disk): keep disk info when df exits with errors

df still prints valid filesystems when a mount point cannot be queried (for example a stale FUSE mount), but exits non-zero. The dashboard and the disk alert discarded the whole output in that case, so no disk was displayed. Keep using the output whenever it is not empty. Refs #13864.
This commit is contained in:
wanghe-fit2cloud
2026-09-20 15:16:15 +08:00
parent 75b60b32e4
commit 680125d5b7
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -382,7 +382,7 @@ func executeDiskCommand() (string, error) {
cmdMgr2 := cmd.NewCommandMgr(cmd.WithTimeout(1 * time.Second))
stdout, err = cmdMgr2.RunWithStdout("df", "-lhT", "-P")
}
if err != nil {
if err != nil && strings.TrimSpace(stdout) == "" {
return stdout, err
}
var lines []string
+1 -1
View File
@@ -469,7 +469,7 @@ func loadDiskInfo() []dto.DiskInfo {
cmd.PipeCommand{Name: "df", Args: []string{"-lhT", "-P"}},
cmd.PipeCommand{Name: "awk", Args: []string{format}},
)
if err != nil {
if err != nil && strings.TrimSpace(stdout) == "" {
return datas
}
}