MCPcopy Create free account
hub / github.com/XiaoMi/mace / run

Method run

tools/python/utils/device.py:197–213  ·  view source on GitHub ↗
(self, target)

Source from the content-addressed store, hash-verified

195 execute("adb -s %s push %s %s" % (sn, lib_file, install_dir), False)
196
197 def run(self, target):
198 tmpdirname = tempfile.mkdtemp()
199 cmd_file_path = tmpdirname + "/cmd.sh"
200 with open(cmd_file_path, "w") as cmd_file:
201 cmd_file.write(str(target))
202 target_dir = os.path.dirname(target.path)
203 execute("adb -s %s push %s %s" % (self._device_id,
204 cmd_file_path,
205 target_dir))
206
207 out = execute("adb -s %s shell sh %s" % (self._device_id,
208 target_dir + "/cmd.sh"))
209 # May have false positive using the following error word
210 for line in out.split("\n")[:-10]:
211 if ("Aborted" in line
212 or "FAILED" in line or "Segmentation fault" in line):
213 raise Exception(line)
214
215 def pull(self, target, out_dir):
216 sn = self._device_id

Callers

nothing calls this directly

Calls 1

executeFunction · 0.85

Tested by

no test coverage detected