Merge pull request #1546 from jlipps/master

go ahead and kill sims before launching a new one
This commit is contained in:
bootstraponline
2013-11-27 06:47:32 -08:00

View File

@@ -632,14 +632,17 @@ IOS.prototype.setDeviceAndLaunchSimulator = function(cb) {
cb(new Error(msg));
} else {
var iosDeviceString = this.getDeviceString();
var isiPhone = iosDeviceString.toLowerCase().indexOf("ipad") === -1;
this.endSimulator(function(err) {
if (err) return cb(err);
var iosDeviceString = this.getDeviceString();
var isiPhone = iosDeviceString.toLowerCase().indexOf("ipad") === -1;
logger.debug("Launching device: " + iosDeviceString);
var iosSimArgs = ["-SimulateDevice", iosDeviceString];
this.iosSimProcess = spawn(iosSimPath, iosSimArgs);
logger.debug("Launching device: " + iosDeviceString);
var iosSimArgs = ["-SimulateDevice", iosDeviceString];
this.iosSimProcess = spawn(iosSimPath, iosSimArgs);
this.setDeviceTypeInInfoPlist(isiPhone ? 1 : 2, cb);
this.setDeviceTypeInInfoPlist(isiPhone ? 1 : 2, cb);
}.bind(this));
}
}
};
@@ -763,7 +766,11 @@ IOS.prototype.endSimulator = function(cb) {
} else {
var cmd = 'killall -9 "iPhone Simulator"';
exec(cmd, { maxBuffer: 524288 }, function(err) {
cb(err);
if (err && err.message.indexOf('matching processes') === -1) {
cb(err);
} else {
cb();
}
});
}
};