From 08b4ab74cf22e9c8ca09594e63b6faae0c529764 Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Sun, 5 May 2024 02:11:43 +0000 Subject: [PATCH] update --- system/host.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/system/host.go b/system/host.go index cd585cb..8a56a38 100644 --- a/system/host.go +++ b/system/host.go @@ -6,6 +6,7 @@ import ( "os" "os/exec" "runtime" + "strings" "time" "github.com/libp2p/go-nat" @@ -17,7 +18,7 @@ func getVmTypeFromSDV(path string) string { cmd := exec.Command(fmt.Sprintf("%s/systemd-detect-virt", path)) output, err := cmd.Output() if err == nil { - switch string(output) { + switch strings.TrimSpace(strings.ReplaceAll(string(output), "\n", "")) { case "kvm": return "KVM" case "xen": @@ -115,6 +116,8 @@ func getHostInfo() (string, string, string, string, string, string, string, stri if err == nil { natType := gateway.Type() NatType = natType + } else { + fmt.Println(err.Error()) } // 获取当前系统的本地时区 CurrentTimeZone = utils.GetTimeZone()