Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit e971775

Browse files
Prevent Future resolved more than once errors
Different node versions have different behaviors of timers. In some cases, on some machines we throw error that future is resolved more than once. Prevent it.
1 parent dae8c83 commit e971775

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mobile/ios/ios-core.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,7 @@ export class GDBServer implements Mobile.IGDBServer {
12131213
clearInterval(timer);
12141214
}
12151215

1216-
if (!retryCount) {
1216+
if (!retryCount && !future.isResolved()) {
12171217
future.throw(new Error("Unable to kill the application."));
12181218
}
12191219
}, 1000);
@@ -1225,7 +1225,9 @@ export class GDBServer implements Mobile.IGDBServer {
12251225
isDataReceived = true;
12261226
this.socket.removeListener("data", dataCallback);
12271227
clearInterval(timer);
1228-
future.return(data.toString());
1228+
if(!future.isResolved()) {
1229+
future.return(data.toString());
1230+
}
12291231
}
12301232
};
12311233

0 commit comments

Comments
 (0)