From fd88ef376a59635172d401a58f74cbf4eac38ad6 Mon Sep 17 00:00:00 2001 From: "yineng.huang" Date: Thu, 18 Jul 2024 09:58:19 +0800 Subject: [PATCH] =?UTF-8?q?wda=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../thread/WindowsAndLinuxIosDeviceInitThread.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cctp-atu/atu-upper-computer/src/main/java/net/northking/cctp/upperComputer/deviceManager/thread/WindowsAndLinuxIosDeviceInitThread.java b/cctp-atu/atu-upper-computer/src/main/java/net/northking/cctp/upperComputer/deviceManager/thread/WindowsAndLinuxIosDeviceInitThread.java index b7f22b5..94a41d8 100644 --- a/cctp-atu/atu-upper-computer/src/main/java/net/northking/cctp/upperComputer/deviceManager/thread/WindowsAndLinuxIosDeviceInitThread.java +++ b/cctp-atu/atu-upper-computer/src/main/java/net/northking/cctp/upperComputer/deviceManager/thread/WindowsAndLinuxIosDeviceInitThread.java @@ -75,7 +75,7 @@ public class WindowsAndLinuxIosDeviceInitThread extends IosDeviceInitThread { cmds.add("tidevice"); cmds.add("-u"); cmds.add(phone.getUdid()); - cmds.add("xcuitest"); + cmds.add("xctest"); cmds.add("-B"); cmds.add(appPackage); cmds.add("--debug"); @@ -92,12 +92,18 @@ public class WindowsAndLinuxIosDeviceInitThread extends IosDeviceInitThread { try { fileOutputStream = new FileOutputStream(wdaLogFile); this.wdaProcess = processBuilder.start(); + if (UpperComputerManager.getInstance().getOperatingSystem().startsWith("Windows")) { + input = new LineNumberReader(new InputStreamReader(this.wdaProcess.getInputStream(),"GBK")); + } else if (UpperComputerManager.getInstance().getOperatingSystem().startsWith("Linux")) { + input = new LineNumberReader(new InputStreamReader(this.wdaProcess.getInputStream(),"UTF-8")); + } input = new LineNumberReader(new InputStreamReader(this.wdaProcess.getInputStream())); String line = null; while (null != (line = input.readLine())) { -// logger.debug("设备【{}】wda程序打印:{}", phone.getUdid(), line); - fileOutputStream.write(line.getBytes(StandardCharsets.UTF_8)); - fileOutputStream.write(10); + if (line.contains(" _device")) { + fileOutputStream.write(line.getBytes(StandardCharsets.UTF_8)); + fileOutputStream.write(10); + } if (line.contains(SUCCESS_FLAG)) { logger.info("设备【{}】的wda程序启动成功,开启nkAgent。。。。。。。。。", phone.getUdid()); createNKAgent();