Skip to content

adb

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.

InterfaceDescription
RunAdbParamsParameters for runAdbBinary and runAdbText.
FunctionDescription
runAdbBinaryRuns adb -s <deviceId> <commandArguments> and returns stdout undecoded.
runAdbTextRuns adb -s <deviceId> <commandArguments> and returns stdout as trimmed text.
runAdbTextWithoutDeviceRuns adb <commandArguments> with no device selected. Only devices needs this — every other call in this family addresses one device.