mac上位机启动specialDeviceInfo
parent
ea017d69e6
commit
822e679f0f
|
@ -2,6 +2,7 @@ package net.northking.cctp.upperComputer.deviceManager;
|
|||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import net.northking.cctp.upperComputer.constants.UpperComputerConstant;
|
||||
import net.northking.cctp.upperComputer.deviceManager.common.Python3;
|
||||
import net.northking.cctp.upperComputer.deviceManager.thread.AppiumEnvironmentThread;
|
||||
import net.northking.cctp.upperComputer.deviceManager.thread.UpperComputerHeartThread;
|
||||
import net.northking.cctp.upperComputer.deviceManager.thread.UsbMuxdDriverThread;
|
||||
|
@ -131,10 +132,17 @@ public class UpperComputerManager {
|
|||
}
|
||||
String computerId = getComputerId();
|
||||
this.setComputerId(computerId);
|
||||
//启动appium
|
||||
boolean auto = Boolean.parseBoolean(SpringUtil.getProperty("nk.mobile-computer.autoEnvironment"));
|
||||
if (auto) { //自动化环境
|
||||
if (!operatingSystem.startsWith("Mac")) {
|
||||
if (operatingSystem.startsWith("Mac")) { //mac作为上位机,不启动appium,因为不接android
|
||||
logger.info("上位机是mac,检查python的环境变量.......................");
|
||||
boolean environmentCheck = Python3.getInstance().checkEnvironment();
|
||||
if (!environmentCheck) {
|
||||
logger.info("上位机的python的环境变量不对.......................");
|
||||
System.exit(1);
|
||||
}
|
||||
} else {
|
||||
//启动appium
|
||||
boolean auto = Boolean.parseBoolean(SpringUtil.getProperty("nk.mobile-computer.autoEnvironment"));
|
||||
if (auto) { //自动化环境
|
||||
String appiumPort = (null == SpringUtil.getProperty("nk.mobile-computer.appium.port") ? "4723" : SpringUtil.getProperty("nk.mobile-computer.appium.port"));
|
||||
String appiumPath = SpringUtil.getProperty("nk.mobile-computer.appium.path");
|
||||
if (!StringUtils.hasText(appiumPath)) {
|
||||
|
|
|
@ -320,12 +320,13 @@ public class Python3 {
|
|||
@Override
|
||||
public void run() {
|
||||
String[] command = createModuleCommand(args);
|
||||
logger.info("启动命令:{}",Arrays.toString(command));
|
||||
ProcessBuilder processBuilder = new ProcessBuilder(command);
|
||||
processBuilder.redirectErrorStream(redirectErrorOutput);
|
||||
try {
|
||||
process = processBuilder.start();
|
||||
} catch (IOException e) {
|
||||
logger.error("启动" + getModuleName() + "时发生输入输出错误,参数:" + Arrays.toString(args), e);
|
||||
logger.error("启动" + getModuleName() + "时发生输入输出错误,参数:" + Arrays.toString(command), e);
|
||||
return;
|
||||
}
|
||||
BufferedReader bufferReader = new BufferedReader(new InputStreamReader(process.getInputStream()));
|
||||
|
@ -353,7 +354,7 @@ public class Python3 {
|
|||
try {
|
||||
int code = process.waitFor();
|
||||
if (code != 0) {
|
||||
logger.warn(getModuleName() + "非正常退出,状态码:" + code + ",参数:" + Arrays.toString(args));
|
||||
logger.warn(getModuleName() + "非正常退出,状态码:" + code + ",参数:" + Arrays.toString(command));
|
||||
}
|
||||
} catch (InterruptedException ignored) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue