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