( deviceId: string, cmd: string | string[] )
| 113 | export async function shell(deviceId: string, cmd: string): Promise<string> |
| 114 | export async function shell(deviceId: string, cmd: string[]): Promise<string[]> |
| 115 | export async function shell( |
| 116 | deviceId: string, |
| 117 | cmd: string | string[] |
| 118 | ): Promise<string | string[]> { |
| 119 | logger.debug('shell', cmd) |
| 120 | |
| 121 | const device = await client.getDevice(deviceId) |
| 122 | const cmds: string[] = isStr(cmd) ? [cmd] : cmd |
| 123 | |
| 124 | const socket = await device.shell(cmds.join('\necho "aya_separator"\n')) |
| 125 | const output: string = (await Adb.util.readAll(socket)).toString() |
| 126 | |
| 127 | if (isStr(cmd)) { |
| 128 | return trim(output) |
| 129 | } |
| 130 | |
| 131 | return map(output.split('aya_separator'), (val) => trim(val)) |
| 132 | } |
| 133 | |
| 134 | export async function forwardTcp(deviceId: string, remote: string) { |
| 135 | const device = await client.getDevice(deviceId) |
no outgoing calls
no test coverage detected