xref: /openbmc/phosphor-bmc-code-mgmt/common/include/utils.hpp (revision 975fbbeb3f11e01a2ba4bcad5213935019e2568b)
1 #pragma once
2 
3 #include <sdbusplus/async.hpp>
4 
5 #include <functional>
6 #include <optional>
7 
8 /**
9  * @brief Asynchronously executes a shell command.
10  * @param ctx Async context for monitoring the pipe.
11  * @param cmd Shell command to execute.
12  * @return Task resolving to true on success (exit code 0), false otherwise.
13  */
14 sdbusplus::async::task<bool> asyncSystem(
15     sdbusplus::async::context& ctx, const std::string& cmd,
16     std::optional<std::reference_wrapper<std::string>> result = std::nullopt);
17