Open
Description
下記はappiumソース:AppiumDriverLocalService.javaのstartメソッド:
/**
-
Starts the defined appium server.
-
@throws AppiumServerHasNotBeenStartedLocallyException If an error occurs while spawning the child process.
-
@see #stop()
*/
public void start() throws AppiumServerHasNotBeenStartedLocallyException {
lock.lock();
try {
if (isRunning()) {
return;
}try { process = new CommandLine(this.nodeJSExec.getCanonicalPath(), nodeJSArgs.toArray(new String[]{})); process.setEnvironmentVariables(nodeJSEnvironment); process.copyOutputTo(stream); process.executeAsync(); //出了异常,在官网上提问下解决方案:这段代码出错一般是什么原因?如何让这个“进场创建”不出错? ping(startupTimeout, timeUnit); } catch (Throwable e) { destroyProcess(); String msgTxt = "The local appium server has not been started. " + "The given Node.js executable: " + this.nodeJSExec.getAbsolutePath() + " Arguments: " + nodeJSArgs.toString() + " " + "\n"; if (process != null) { String processStream = process.getStdOut(); if (!StringUtils.isBlank(processStream)) { msgTxt = msgTxt + "Process output: " + processStream + "\n"; } } throw new AppiumServerHasNotBeenStartedLocallyException(msgTxt, e); }
} finally {
lock.unlock();
}
}