fix: replace adb with gadb shell command

This commit is contained in:
lilong.129
2024-12-10 10:27:16 +08:00
parent f7dc9bb0da
commit f6d49495e0
3 changed files with 5 additions and 4 deletions

View File

@@ -1 +1 @@
v5.0.0+2412081512
v5.0.0+2412101027

View File

@@ -17,7 +17,6 @@ import (
"syscall"
"time"
"github.com/httprunner/funplugin/myexec"
"github.com/pkg/errors"
"github.com/rs/zerolog/log"
@@ -797,7 +796,7 @@ func (ad *adbDriver) StopCaptureLog() (result interface{}, err error) {
log.Info().Msg("action log is null, use action file >>>")
logFilePathPrefix := fmt.Sprintf("%v/data", config.ActionLogFilePath)
files := []string{}
myexec.RunCommand("adb", "-s", ad.adbClient.Serial(), "pull", config.DeviceActionLogFilePath, config.ActionLogFilePath)
ad.adbClient.RunShellCommand("pull", config.DeviceActionLogFilePath, config.ActionLogFilePath)
err = filepath.Walk(config.ActionLogFilePath, func(path string, info fs.FileInfo, err error) error {
// 只是需要日志文件
if ok := strings.Contains(path, logFilePathPrefix); ok {

View File

@@ -362,7 +362,8 @@ func (dev *AndroidDevice) StopPcap() string {
}
func (dev *AndroidDevice) Uninstall(packageName string) error {
return myexec.RunCommand("adb", "-s", dev.SerialNumber, "uninstall", packageName)
_, err := dev.d.RunShellCommand("uninstall", packageName)
return err
}
func (dev *AndroidDevice) Install(apkPath string, options ...InstallOption) error {
@@ -689,6 +690,7 @@ func (l *AdbLogcat) CatchLogcat(filter string) (err error) {
return nil
}
// FIXME: replace with gadb shell command
// clear logcat
if err = myexec.RunCommand("adb", "-s", l.serial, "shell", "logcat", "-c"); err != nil {
return