blob: 65d7022c3973afcf7a789f5820ea8711f1931552 [file] [log] [blame]
Kevin Tunga2eb9512025-05-05 18:28:56 +08001#pragma once
2
3#include <sdbusplus/async.hpp>
4
Kevin Tungc5387272025-07-28 18:10:43 +08005#include <functional>
6#include <optional>
7
Kevin Tunga2eb9512025-05-05 18:28:56 +08008/**
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 Tungc5387272025-07-28 18:10:43 +080014sdbusplus::async::task<bool> asyncSystem(
15 sdbusplus::async::context& ctx, const std::string& cmd,
16 std::optional<std::reference_wrapper<std::string>> result = std::nullopt);