mirror of
https://github.com/httprunner/httprunner.git
synced 2026-08-28 03:30:01 +08:00
feat: get ios running processes by ps
This commit is contained in:
+24
-1
@@ -1,12 +1,35 @@
|
||||
package ios
|
||||
|
||||
import "github.com/spf13/cobra"
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
giDevice "github.com/electricbubble/gidevice"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/httprunner/httprunner/v4/hrp/internal/uixt"
|
||||
)
|
||||
|
||||
var iosRootCmd = &cobra.Command{
|
||||
Use: "ios",
|
||||
Short: "simple utils for ios device management",
|
||||
}
|
||||
|
||||
func getDevice(udid string) (giDevice.Device, error) {
|
||||
devices, err := uixt.IOSDevices(udid)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(devices) == 0 {
|
||||
fmt.Println("no ios device found")
|
||||
os.Exit(1)
|
||||
}
|
||||
if len(devices) > 1 {
|
||||
return nil, fmt.Errorf("multiple devices found, please specify udid")
|
||||
}
|
||||
return devices[0], nil
|
||||
}
|
||||
|
||||
func Init(rootCmd *cobra.Command) {
|
||||
rootCmd.AddCommand(iosRootCmd)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user