MCPcopy
hub / github.com/liriliri/aya / shell

Function shell

src/main/lib/adb/base.ts:115–132  ·  view source on GitHub ↗
(
  deviceId: string,
  cmd: string | string[]
)

Source from the content-addressed store, hash-verified

113export async function shell(deviceId: string, cmd: string): Promise<string>
114export async function shell(deviceId: string, cmd: string[]): Promise<string[]>
115export 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
134export async function forwardTcp(deviceId: string, remote: string) {
135 const device = await client.getDevice(deviceId)

Callers 15

getOverviewFunction · 0.90
getIpAndMacFunction · 0.90
setFontScaleFunction · 0.90
getUptimeFunction · 0.90
getBatteryFunction · 0.90
dumpWindowHierarchyFunction · 0.90
getScreenFunction · 0.90
getMemoryFunction · 0.90
getStorageFunction · 0.90
rootFunction · 0.90
pullFileFunction · 0.90
readDataAppDirFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected