MCPcopy
hub / github.com/callstack/agent-device / resolveAndroidPid

Function resolveAndroidPid

src/daemon/app-log-android.ts:29–40  ·  view source on GitHub ↗
(
  deviceId: string,
  appBundleId: string,
)

Source from the content-addressed store, hash-verified

27}
28
29export async function resolveAndroidPid(
30 deviceId: string,
31 appBundleId: string,
32): Promise<string | null> {
33 const pidResult = await resolveAndroidAdbExecutor(androidDeviceForSerial(deviceId))(
34 ['shell', 'pidof', appBundleId],
35 { allowFailure: true },
36 );
37 const pid = pidResult.stdout.trim().split(/\s+/)[0];
38 if (!pid || !/^\d+$/.test(pid)) return null;
39 return pid;
40}
41
42export function readTrackedAndroidLogcatPid(pidPath: string | undefined): string | null {
43 const command = readStoredAppLogProcessMeta(pidPath)?.command;

Calls 2

androidDeviceForSerialFunction · 0.90

Tested by

no test coverage detected