Kevin Tung | a2eb951 | 2025-05-05 18:28:56 +0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <sdbusplus/async.hpp> |
| 4 | |
Kevin Tung | c538727 | 2025-07-28 18:10:43 +0800 | [diff] [blame] | 5 | #include <functional> |
| 6 | #include <optional> |
| 7 | |
Kevin Tung | a2eb951 | 2025-05-05 18:28:56 +0800 | [diff] [blame] | 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 | */ |
Kevin Tung | c538727 | 2025-07-28 18:10:43 +0800 | [diff] [blame] | 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); |