From 356c0b96113c32cdd8b9f73ba94fb0a595c8479e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=A5=E5=88=A9=E5=A5=A5=E5=97=B7=E5=97=B7=E5=8F=AB?= Date: Fri, 3 Feb 2023 21:43:14 +0800 Subject: [PATCH] delete "/bin" --- src/perfmonUtil/process.go | 8 ++++---- src/perfmonUtil/system.go | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/perfmonUtil/process.go b/src/perfmonUtil/process.go index 7ba8ebc..48cc5bd 100644 --- a/src/perfmonUtil/process.go +++ b/src/perfmonUtil/process.go @@ -34,9 +34,9 @@ import ( ) func getStatOnPid(client *adb.Device, pid string) (stat *entity.ProcessStat, err error) { - lines, err := client.OpenShell(fmt.Sprintf("/bin/cat /proc/%s/stat", pid)) + lines, err := client.OpenShell(fmt.Sprintf("cat /proc/%s/stat", pid)) if err != nil { - return nil, fmt.Errorf("exec command erro : " + fmt.Sprintf("/bin/cat /proc/%s/stat", pid)) + return nil, fmt.Errorf("exec command erro : " + fmt.Sprintf("cat /proc/%s/stat", pid)) } data, err := ioutil.ReadAll(lines) if err != nil { @@ -67,9 +67,9 @@ func GetPidOnPackageName(client *adb.Device, appName string) (pid string, err er } func getStatusOnPid(client *adb.Device, pid string) (status *entity.ProcessStatus, err error) { - lines, err1 := client.OpenShell(fmt.Sprintf("/bin/cat /proc/%s/status", pid)) + lines, err1 := client.OpenShell(fmt.Sprintf("cat /proc/%s/status", pid)) if err1 != nil { - return status, fmt.Errorf("exec command erro : " + fmt.Sprintf("/bin/cat /proc/%s/status", pid)) + return status, fmt.Errorf("exec command erro : " + fmt.Sprintf("cat /proc/%s/status", pid)) } data, err := ioutil.ReadAll(lines) if err != nil { diff --git a/src/perfmonUtil/system.go b/src/perfmonUtil/system.go index 866d310..54b2e1d 100644 --- a/src/perfmonUtil/system.go +++ b/src/perfmonUtil/system.go @@ -65,7 +65,7 @@ func GetSystemStats(client *adb.Device, perfOptions entity.PerfOption) (stats *e } func getMemInfo(client *adb.Device, stats *entity.SystemInfo) (err error) { - lines, err := client.OpenShell("/bin/cat /proc/meminfo") + lines, err := client.OpenShell("cat /proc/meminfo") if err != nil { return } @@ -102,10 +102,10 @@ func getMemInfo(client *adb.Device, stats *entity.SystemInfo) (err error) { func getInterfaces(client *adb.Device, stats *entity.SystemInfo) (err error) { var lines io.ReadCloser - lines, err = client.OpenShell("/bin/ip -o addr") + lines, err = client.OpenShell("ip -o addr") if err != nil { // try /sbin/ip - lines, err = client.OpenShell("/sbin/ip -o addr") + lines, err = client.OpenShell("/bin/ip -o addr") if err != nil { return } @@ -145,7 +145,7 @@ func getInterfaces(client *adb.Device, stats *entity.SystemInfo) (err error) { } func getInterfaceInfo(client *adb.Device, stats *entity.SystemInfo) (err error) { - lines, err := client.OpenShell("/bin/cat /proc/net/dev") + lines, err := client.OpenShell("cat /proc/net/dev") if err != nil { return } @@ -216,7 +216,7 @@ var preCPU entity.SystemCpuRaw var preCPUMap map[string]entity.SystemCpuRaw func getCPU(client *adb.Device, stats *entity.SystemInfo) (err error) { - lines, err := client.OpenShell("/bin/cat /proc/stat") + lines, err := client.OpenShell("cat /proc/stat") if err != nil { return }