MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / run_command

Method run_command

OpenHD/ohd_common/src/openhd_util.cpp:52–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50}
51
52int OHDUtil::run_command(const std::string& command,
53 const std::vector<std::string>& args,
54 bool print_debug) {
55 const auto command_with_args = create_command_with_args(command, args);
56 if (print_debug) {
57 openhd::log::get_default()->debug("run command begin [{}]",
58 command_with_args);
59 }
60 // https://man7.org/linux/man-pages/man3/system.3.html
61 const auto ret = std::system(command_with_args.c_str());
62 // openhd::log::get_default()->debug("return code:{}",ret);
63 if (ret < 0) {
64 openhd::log::get_default()->warn("Invalid command, return code {}", ret);
65 }
66 return ret;
67}
68
69std::optional<std::string> OHDUtil::run_command_out(const std::string& command,
70 const bool debug) {

Callers

nothing calls this directly

Calls 1

debugMethod · 0.80

Tested by

no test coverage detected