MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / adb_shell

Method adb_shell

source/MaaAdbControlUnit/EmulatorExtras/AndrowsExtras.cpp:319–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319std::optional<std::string> AndrowsExtras::adb_shell(const std::string& cmd)
320{
321 argv_replace_["{ANDROWS_SHELL_CMD}"] = cmd;
322
323 auto argv_opt = adb_shell_argv_.gen(argv_replace_);
324 argv_replace_.erase("{ANDROWS_SHELL_CMD}");
325
326 if (!argv_opt) {
327 LogError << "Androws: failed to generate adb shell argv for cmd:" << cmd;
328 return std::nullopt;
329 }
330
331 auto output_opt = startup_and_read_pipe(*argv_opt);
332 if (!output_opt) {
333 return std::nullopt;
334 }
335
336 std::string& output = *output_opt;
337 while (!output.empty() && (output.back() == '\n' || output.back() == '\r' || output.back() == ' ')) {
338 output.pop_back();
339 }
340
341 return output;
342}
343
344MAA_CTRL_UNIT_NS_END
345

Callers

nothing calls this directly

Calls 2

genMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected