mirror of
https://github.com/appium/appium.git
synced 2026-02-12 21:10:10 -06:00
@@ -132,9 +132,17 @@ Instruments.prototype.start = function(readyCb, exitCb) {
|
||||
this.debug("Instruments socket server closed");
|
||||
}.bind(this));
|
||||
|
||||
exec('xcrun -find instruments', function (error, stdout) {
|
||||
exec('xcrun -find instruments', function (err, stdout) {
|
||||
if (typeof stdout === "undefined") stdout = "";
|
||||
this.instrumentsPath = stdout.trim();
|
||||
logger.info("instruments is: " + this.instrumentsPath);
|
||||
if (err || !this.instrumentsPath) {
|
||||
logger.error("Could not find instruments binary");
|
||||
if (err) logger.error(err.message);
|
||||
clearTimeout(socketConnectTimeout);
|
||||
return this.readyHandler(new Error("Could not find the instruments " +
|
||||
"binary. Please ensure `xcrun -find instruments` can locate it."));
|
||||
}
|
||||
logger.info("Instruments is at: " + this.instrumentsPath);
|
||||
|
||||
this.socketServer.listen(this.sock, function() {
|
||||
this.debug("Instruments socket server started at " + this.sock);
|
||||
|
||||
@@ -104,7 +104,7 @@ IOS.prototype.init = function(args) {
|
||||
this.localizableStrings = {};
|
||||
};
|
||||
|
||||
IOS.prototype.cleanup = function(cb) {
|
||||
IOS.prototype.preCleanup = function(cb) {
|
||||
var removeTracedirs = function(innerCb) {
|
||||
if (this.removeTraceDir) {
|
||||
logger.info("Cleaning up any tracedirs");
|
||||
@@ -180,7 +180,7 @@ IOS.prototype.start = function(cb, onDie) {
|
||||
}
|
||||
|
||||
async.series([
|
||||
this.cleanup.bind(this),
|
||||
this.preCleanup.bind(this),
|
||||
this.setXcodeFolder.bind(this),
|
||||
this.setXcodeVersion.bind(this),
|
||||
this.setiOSSDKVersion.bind(this),
|
||||
@@ -214,7 +214,18 @@ IOS.prototype.startInstruments = function(cb) {
|
||||
, webSocket: this.webSocket
|
||||
, launchTimeout: this.launchTimeout
|
||||
});
|
||||
this.instruments.start(cb, function(code, tracedir) {
|
||||
this.instruments.start(function(err) {
|
||||
if (err) {
|
||||
if (this.logs !== null) {
|
||||
this.logs.stopCapture();
|
||||
this.logs = null;
|
||||
}
|
||||
this.postCleanup(function() {
|
||||
cb(err);
|
||||
});
|
||||
}
|
||||
cb();
|
||||
}.bind(this), function(code, tracedir) {
|
||||
this.onInstrumentsExit(code, tracedir, cb);
|
||||
}.bind(this));
|
||||
};
|
||||
@@ -321,6 +332,7 @@ IOS.prototype.onInstrumentsExit = function(code, traceDir, launchCb) {
|
||||
|
||||
if (this.logs !== null) {
|
||||
this.logs.stopCapture();
|
||||
this.logs = null;
|
||||
}
|
||||
|
||||
async.series([removeTraceDir, cleanup], function() {});
|
||||
@@ -736,13 +748,14 @@ IOS.prototype.postCleanup = function(cb) {
|
||||
function(cb) { this.cleanupAppState(cb); }.bind(this),
|
||||
], cb);
|
||||
} else {
|
||||
logger.info("Reset set to false, not ending sim or cleaning up app state");
|
||||
cb();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
IOS.prototype.endSimulator = function(cb) {
|
||||
|
||||
logger.info("Killing the simulator process");
|
||||
if (this.iosSimProcess) {
|
||||
this.iosSimProcess.kill("SIGHUP");
|
||||
this.iosSimProcess = null;
|
||||
|
||||
Reference in New Issue
Block a user