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

Function streamAndroidLogcatWithAdb

src/platforms/android/logcat.ts:40–58  ·  view source on GitHub ↗
(
  provider: Pick<AndroidAdbProvider, 'spawn'>,
  options: AndroidLogcatStreamOptions = {},
)

Source from the content-addressed store, hash-verified

38}
39
40export function streamAndroidLogcatWithAdb(
41 provider: Pick<AndroidAdbProvider, 'spawn'>,
42 options: AndroidLogcatStreamOptions = {},
43): AndroidAdbProcess {
44 if (!provider.spawn) {
45 throw new AppError('UNSUPPORTED_OPERATION', 'Android ADB provider does not support streams', {
46 capability: 'adb.spawn',
47 });
48 }
49 const args = ['logcat', '-v', 'time'];
50 if (options.pid) {
51 args.push('--pid', options.pid);
52 }
53 const child = provider.spawn(args, { stdio: ['ignore', 'pipe', 'pipe'], signal: options.signal });
54 if (options.output && child.stdout) {
55 child.stdout.pipe(options.output, { end: false });
56 }
57 return child;
58}

Callers 2

startAndroidAppLogFunction · 0.90
logcat.test.tsFile · 0.90

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected