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

Method handle_shell

source/MaaFramework/Controller/ControllerAgent.cpp:885–909  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

883}
884
885bool ControllerAgent::handle_shell(const ShellParam& param)
886{
887 if (!control_unit_) {
888 LogError << "control_unit_ is nullptr";
889 return false;
890 }
891
892 std::string output;
893 auto timeout = param.shell_timeout < 0 ? std::chrono::milliseconds::max() : std::chrono::milliseconds(param.shell_timeout);
894
895 auto unit = std::dynamic_pointer_cast<MAA_CTRL_UNIT_NS::ShellableUnit>(control_unit_);
896 if (!unit) {
897 LogError << "Shell is not supported for this controller type";
898 return false;
899 }
900
901 bool ret = unit->shell(param.cmd, output, timeout);
902
903 if (ret) {
904 std::unique_lock lock(shell_output_mutex_);
905 shell_output_ = std::move(output);
906 }
907
908 return ret;
909}
910
911bool ControllerAgent::check_stop()
912{

Callers

nothing calls this directly

Calls 2

moveFunction · 0.85
shellMethod · 0.65

Tested by

no test coverage detected