/** * @file * * Runs `adb` and hands back what it printed — as text, or as raw bytes. * * The harness already shells out to `adb` in half a dozen places inside * `transport-factory` / `transport-appium`, but always through `exec`, which * decodes stdout as UTF-8. That is fine for `devices` and `settings get` and * fatally wrong for `exec-out screencap -p`, whose stdout is a PNG: decoding it * as text corrupts every byte above 0x7F. Hence the two runners here — the same * command shape, differing only in whether the output is decoded. * * These are the process layer for the device-facing helpers a capture suite * uses (`device-screenshot`, `device-settings`, `soft-keyboard`); they are not a * general-purpose adb wrapper and deliberately do not try to become one. * * Every function here shells out, so the whole module is integration-time code. * That is also why the parsing and geometry these helpers depend on live in * their own modules — the same split `adb-device-list` already has from the * transport factory, so a sort rule can never move a unit-tested function * inside a coverage-ignored block. */ /** * Parameters for {@link runAdbBinary} and {@link runAdbText}. */ export interface RunAdbParams { /** * The arguments to pass after `-s `, e.g. `['shell', 'input', 'tap', '10', '20']`. */ readonly commandArguments: readonly string[]; /** * The device to address, as `adb devices` lists it. */ readonly deviceId: string; } /** * Runs `adb -s ` and returns stdout **undecoded**. * * @param params - The device and the arguments to run. * @returns A {@link Promise} that resolves to the raw stdout bytes. * @throws Error if adb could not be run, or exited non-zero. */ export declare function runAdbBinary(params: RunAdbParams): Promise; /** * Runs `adb -s ` and returns stdout as trimmed text. * * @param params - The device and the arguments to run. * @returns A {@link Promise} that resolves to stdout, with surrounding whitespace removed. * @throws Error if adb could not be run, or exited non-zero. */ export declare function runAdbText(params: RunAdbParams): Promise; /** * Runs `adb ` with no device selected. * * Only `devices` needs this — every other call in this family addresses one device. * * @param commandArguments - The arguments to run. * @returns A {@link Promise} that resolves to stdout, with surrounding whitespace removed. * @throws Error if adb could not be run, or exited non-zero. */ export declare function runAdbTextWithoutDevice(commandArguments: readonly string[]): Promise;