(
adb: AndroidAdbExecutor,
options: AndroidLogcatCaptureOptions = {},
)
| 15 | }; |
| 16 | |
| 17 | export async function captureAndroidLogcatWithAdb( |
| 18 | adb: AndroidAdbExecutor, |
| 19 | options: AndroidLogcatCaptureOptions = {}, |
| 20 | ): Promise<string> { |
| 21 | const args = ['logcat', '-d', '-v', 'time']; |
| 22 | if (options.lines !== undefined) { |
| 23 | args.push('-t', String(Math.max(1, Math.floor(options.lines)))); |
| 24 | } |
| 25 | const result = await adb(args, { |
| 26 | allowFailure: true, |
| 27 | timeoutMs: options.timeoutMs, |
| 28 | signal: options.signal, |
| 29 | }); |
| 30 | if (result.exitCode !== 0) { |
| 31 | throw new AppError('COMMAND_FAILED', 'Failed to capture Android logcat', { |
| 32 | stdout: result.stdout, |
| 33 | stderr: result.stderr, |
| 34 | exitCode: result.exitCode, |
| 35 | }); |
| 36 | } |
| 37 | return result.stdout; |
| 38 | } |
| 39 | |
| 40 | export function streamAndroidLogcatWithAdb( |
| 41 | provider: Pick<AndroidAdbProvider, 'spawn'>, |
no test coverage detected