Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var err = new Error(__('Unsupported platform "%s"', process.platform));
emitter.emit('error', err);
callback(err);
});
return emitter;
}
if (cache && !options.bypassCache) {
process.nextTick(function () {
emitter.emit('detected', cache);
callback(null, cache);
});
return emitter;
}
iosDevice.devices(function (err, devices) {
process.nextTick(function () {
if (err) {
emitter.emit('error', err);
return callback(err);
}
cache = {
devices: JSON.parse(JSON.stringify(devices)),
issues: []
};
emitter.emit('detected', cache);
callback(null, cache);
});
});
exports.detectDevices = function detectDevices(finished) {
iosDevice.devices(function (err, devices) {
if (err) {
finished(err);
} else {
devices.unshift({
udid: 'itunes',
name: __('iTunes Sync')
});
finished(null, devices.map(function (d) {
d.id = d.udid;
return d;
}));
}
});
};
function checkAttachedDevices(info) {
if (process.argv.indexOf('--auto-device') !== -1) {
logger.info('Getting details of attached devices.');
iosDevice.devices(function(err, devices) {
logger.info("Found " + devices.length + " connected devices");
if (devices.length == 1) {
selectedDevice = devices[0];
logger.info('Attached device name: ' + selectedDevice.name);
device.name = selectedDevice.name;
device.UDID = selectedDevice.udid;
getPPDetails(info);
} else if (devices.length > 1) {
//prompt user to select the device
promptToSelectDevice(devices, function(selected) {
selectedDevice = JSON.parse(selected);
logger.info('Selected device name' + selectedDevice.name);
device.name = selectedDevice.name;
device.UDID = selectedDevice.udid;
addCliArg(cli, 'C', selectedDevice.udid);
getPPDetails(info);
return tailgate('ioslib:devices', () => new Promise((resolve, reject) => {
iosDevice.devices((err, devices) => {
return err ? reject(err) : resolve(devices.map(d => new Device(d)));
});
}));
}