Merge pull request #1202 from penguinho/udidetect

Fixes from code review on #1161
This commit is contained in:
bootstraponline
2013-09-21 14:02:07 -07:00
+4 -2
View File
@@ -317,20 +317,22 @@ IOS.prototype.onInstrumentsExit = function(code, traceDir, launchCb) {
};
IOS.prototype.detectUdid = function (cb) {
if (this.udid !== null && this.udid == "auto") {
if (this.udid !== null && this.udid === "auto") {
logger.info("Auto-detecting iOS udid...");
var udidetectPath = path.resolve(__dirname, "../build/udidetect/udidetect");
var udiddetectProc = exec(udidetectPath, { maxBuffer: 524288, timeout: 3000 }, function(err, stdout) {
if (stdout && stdout.length > 2) {
this.udid = stdout.replace("\n","");
logger.info("Detected udid as " + this.udid);
cb();
} else {
logger.error("Could not detect udid.");
cb(new Error("Could not detect udid."));
}
cb();
}.bind(this));
udiddetectProc.on('timeout', function () {
logger.error("Timed out trying to detect udid.");
cb(new Error("Timed out trying to detect udid."));
});
} else {
cb();