Skip to content

Commit c5eb754

Browse files
fix: Do not wait 15 seconds to detect simulator
Currently when we want to detect iOS Simulators we have a setInterval that iterrates 30 times for 500ms. When you do not have any iOS Simulator, this causes 15 seconds of waiting. Just retry once and continue, if the simulators don't show up, well, they do not want to work with you.
1 parent 56e3abb commit c5eb754

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/ios-sim.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Object.defineProperty(publicApi, "getRunningSimulators", {
5555
return new Promise<any>((resolve, reject) => {
5656
const libraryPath = require("./iphone-simulator-xcode-simctl");
5757
const simulator = new libraryPath.XCodeSimctlSimulator();
58-
58+
5959
const tryGetBootedDevices = () => {
6060
try {
6161
return simulator.getBootedDevices.apply(simulator, args);
@@ -75,15 +75,13 @@ Object.defineProperty(publicApi, "getRunningSimulators", {
7575
}
7676

7777
if (!isResolved && (!result || !result.length)) {
78-
let repeatCount = 30;
79-
const timer = setInterval(() => {
78+
const timer = setTimeout(() => {
8079
result = tryGetBootedDevices();
81-
if (((result && result.length) || !repeatCount) && !isResolved) {
80+
81+
if (!isResolved) {
8282
isResolved = true;
83-
clearInterval(timer);
8483
resolve(result);
8584
}
86-
repeatCount--;
8785
}, 500);
8886
}
8987
});

0 commit comments

Comments
 (0)