fix at least one case of ios sims not being killed

cc @penguinho
This commit is contained in:
Jonathan Lipps
2013-11-26 11:34:04 -08:00
parent a9da500c26
commit 7d4dbda6a2

View File

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