wda日志打印优化

master
yineng.huang 2024-07-18 09:58:19 +08:00
parent ac729d46c1
commit fd88ef376a
1 changed files with 10 additions and 4 deletions

View File

@ -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();