Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions src/platforms/android/adb.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { whichCmd } from '../../utils/exec.ts';
import { AppError } from '../../utils/errors.ts';
import type { DeviceInfo } from '../../utils/device.ts';

export function adbArgs(device: DeviceInfo, args: string[]): string[] {
return ['-s', device.id, ...args];
}

export async function ensureAdb(): Promise<void> {
const adbAvailable = await whichCmd('adb');
if (!adbAvailable) throw new AppError('TOOL_MISSING', 'adb not found in PATH');
}

export function isClipboardShellUnsupported(stdout: string, stderr: string): boolean {
const haystack = `${stdout}\n${stderr}`.toLowerCase();
return haystack.includes('no shell command implementation') || haystack.includes('unknown command');
}

export async function sleep(ms: number): Promise<void> {
await new Promise((resolve) => setTimeout(resolve, ms));
}
Loading
Loading