Skip to content

Commit e516a83

Browse files
tlancinaimhoffd
authored andcommitted
fix(ios): log iOS --list errors, but still print
1 parent 49819b0 commit e516a83

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

src/ios/list.ts

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
1+
import * as Debug from 'debug';
12
import { DeviceValues } from 'node-ioslib';
23

34
import { Target, list } from '../utils/list';
45

56
import { getConnectedDevices } from './utils/device';
67
import { Simulator, getSimulators } from './utils/simulator';
78

9+
const debug = Debug('native-run:ios:list');
10+
811
export async function run(args: string[]) {
9-
// TODO check for darwin?
10-
const [ devices, simulators ] = await Promise.all([
11-
(await getConnectedDevices()).map(deviceToTarget),
12-
(await getSimulators()).map(simulatorToTarget),
13-
]);
12+
const devicesPromise = getConnectedDevices()
13+
.then(devices => devices.map(deviceToTarget))
14+
.catch(err => {
15+
debug(`There was an error getting the iOS device list: ${err.message}`);
16+
return [];
17+
});
18+
19+
const simulatorsPromise = getSimulators()
20+
.then(simulators => simulators.map(simulatorToTarget))
21+
.catch(err => {
22+
debug(`There was an error getting the iOS simulator list: ${err.message}`);
23+
return [];
24+
});
25+
26+
const [ devices, simulators ] = await Promise.all([devicesPromise, simulatorsPromise]);
1427

1528
return list(args, devices, simulators);
1629
}

0 commit comments

Comments
 (0)