Fix missing simulator bug
Summary: Apple has changed the xcrun api in some cases, it seems. Adding support for true instead of YES... Reviewed By: danielbuechele Differential Revision: D15940810 fbshipit-source-id: 94ba2733527e005b989fb5a62ffbab2f7a0243b9
This commit is contained in:
committed by
Facebook Github Bot
parent
c4acfa6507
commit
fdd75a123f
@@ -21,13 +21,24 @@ import {registerDeviceCallbackOnPlugins} from '../utils/onRegisterDevice.js';
|
||||
type iOSSimulatorDevice = {|
|
||||
state: 'Booted' | 'Shutdown' | 'Shutting Down',
|
||||
availability?: string,
|
||||
isAvailable?: 'YES' | 'NO',
|
||||
isAvailable?: 'YES' | 'NO' | true | false,
|
||||
name: string,
|
||||
udid: string,
|
||||
|};
|
||||
|
||||
type IOSDeviceParams = {udid: string, type: DeviceType, name: string};
|
||||
|
||||
function isAvailable(simulator: iOSSimulatorDevice): boolean {
|
||||
// For some users "availability" is set, for others it's "isAvailable"
|
||||
// It's not clear which key is set, so we are checking both.
|
||||
// We've also seen isAvailable return "YES" and true, depending on version.
|
||||
return (
|
||||
simulator.availability === '(available)' ||
|
||||
simulator.isAvailable === 'YES' ||
|
||||
simulator.isAvailable === true
|
||||
);
|
||||
}
|
||||
|
||||
const portforwardingClient = isProduction()
|
||||
? path.resolve(
|
||||
__dirname,
|
||||
@@ -119,12 +130,7 @@ function getActiveSimulators(): Promise<Array<IOSDeviceParams>> {
|
||||
|
||||
return simulators
|
||||
.filter(
|
||||
simulator =>
|
||||
simulator.state === 'Booted' &&
|
||||
// For some users "availability" is set, for others it's "isAvailable"
|
||||
// It's not clear which key is set, so we are checking both.
|
||||
(simulator.availability === '(available)' ||
|
||||
simulator.isAvailable === 'YES'),
|
||||
simulator => simulator.state === 'Booted' && isAvailable(simulator),
|
||||
)
|
||||
.map(simulator => {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user