mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 19:47:14 +08:00
fix: improve package running check and enhance logging in UIA2Driver
This commit is contained in:
+10
-1
@@ -728,7 +728,16 @@ func (d *Device) IsPackageInstalled(packageName string) bool {
|
||||
}
|
||||
|
||||
func (d *Device) IsPackageRunning(packageName string) bool {
|
||||
output, err := d.RunShellCommand("pidof", packageName)
|
||||
packageName = strings.TrimSpace(packageName)
|
||||
if packageName == "" {
|
||||
log.Error().Msg("package name is empty, skip checking package running")
|
||||
return false
|
||||
}
|
||||
|
||||
// Use ps -ef command with grep to check if package is running
|
||||
// ps -ef shows full command line which includes package name as argument
|
||||
// This works for both regular apps and instrumentation test processes
|
||||
output, err := d.RunShellCommand("ps -ef | grep " + packageName + " | grep -v grep")
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user