Skip to content

Commit 70ebc6d

Browse files
committed
Add a timeout to Android Frida connectivity checks
1 parent e7cd461 commit 70ebc6d

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/interceptors/frida/frida-android-integration.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { CustomError } from '@httptoolkit/util';
22
import { Client as AdbClient, DeviceClient } from '@devicefarmer/adbkit';
33
import * as FridaJs from 'frida-js';
44

5-
import { waitUntil } from '../../util/promise';
5+
import { waitUntil, withTimeout } from '../../util/promise';
66
import { HtkConfig } from '../../config';
77
import {
88
EMULATOR_HOST_IPS,
@@ -38,7 +38,8 @@ const isFridaInstalled = (deviceClient: DeviceClient) =>
3838
.catch(() => false);
3939

4040
const isDevicePortOpen = (deviceClient: DeviceClient, port: number) =>
41-
deviceClient.openTcp(port).then((conn) => {
41+
withTimeout(1000, deviceClient.openTcp(port))
42+
.then((conn) => {
4243
// If the connection opened at all, then something is listening...
4344
conn.on('error', () => {});
4445
conn.end();

0 commit comments

Comments
 (0)