MCPcopy Create free account
hub / github.com/HexHive/NASS / execute_runas_command

Function execute_runas_command

adb.py:132–160  ·  view source on GitHub ↗

Executes the given privileged command on the device

(
    cmd, device_id, user, wait_for_termination=True, timeout=None, do_log=True
)

Source from the content-addressed store, hash-verified

130
131
132def execute_runas_command(
133 cmd, device_id, user, wait_for_termination=True, timeout=None, do_log=True
134):
135 """Executes the given privileged command on the device"""
136 if (
137 device_id in FANS_PIXEL_2_XL
138 or (type(device_id) == bytes and b"emulator" in device_id)
139 or (type(device_id) == str and "emulator" in device_id)
140 ):
141 out, err = call_adb(
142 ["shell", "su {} sh -c '{}'".format(user, cmd)],
143 device_id=device_id,
144 wait_for_termination=wait_for_termination,
145 timeout=timeout,
146 do_log=do_log,
147 )
148 else:
149 out, err = call_adb(
150 ["shell", "su {} -c '{}'".format(user, cmd)],
151 device_id=device_id,
152 wait_for_termination=wait_for_termination,
153 timeout=timeout,
154 do_log=do_log,
155 )
156 if err:
157 log.debug(
158 f">>>[{device_id}]>>> error executing command as {user} cmd. err: {err}"
159 )
160 return out, err
161
162
163def execute_nobody_command(

Callers

nothing calls this directly

Calls 1

call_adbFunction · 0.85

Tested by

no test coverage detected