Return meaningful error when no devices available
Summary: `react-native run-ios --device` should report 'No iOS devices connected.' in case when no devices attached. However due to logic bug when empty array is being treatened as a boolean value, cli reports odd message, saying `Could not find device with the name: "true".` Disconnect all iOS devices from developer machine and run `react-native run-ios --device` in any project - console message should state that there are no devices available. Closes https://github.com/facebook/react-native/pull/15603 Differential Revision: D5686891 Pulled By: shergin fbshipit-source-id: 289461b6f920691ad39e940ecca6d85cf2a3573b
This commit is contained in:
parent
743dc20aac
commit
ad4aee7519
|
@ -50,7 +50,7 @@ function runIOS(argv, config, args) {
|
|||
if (selectedDevice) {
|
||||
return runOnDevice(selectedDevice, scheme, xcodeProject, args.configuration, args.packager);
|
||||
} else {
|
||||
if (devices){
|
||||
if (devices && devices.length > 0) {
|
||||
console.log('Could not find device with the name: "' + args.device + '".');
|
||||
console.log('Choose one of the following:');
|
||||
printFoundDevices(devices);
|
||||
|
@ -70,7 +70,7 @@ function runOnDeviceByUdid(args, scheme, xcodeProject, devices) {
|
|||
if (selectedDevice) {
|
||||
return runOnDevice(selectedDevice, scheme, xcodeProject, args.configuration, args.packager);
|
||||
} else {
|
||||
if (devices){
|
||||
if (devices && devices.length > 0) {
|
||||
console.log('Could not find device with the udid: "' + args.udid + '".');
|
||||
console.log('Choose one of the following:');
|
||||
printFoundDevices(devices);
|
||||
|
|
Loading…
Reference in New Issue