execAndWait: Capture stdout
Change-Id: I142841a56058b73670bee0456a324ffb17539f95
diff --git a/src/utils/exec.h b/src/utils/exec.h
index 80292b7..6384b9d 100644
--- a/src/utils/exec.h
+++ b/src/utils/exec.h
@@ -12,16 +12,18 @@
namespace velia::utils {
/**
- * Spawns a new process with an executable specified by `absolutePath` and waits until it returns. stdout is thrown
- * away. Throws if the program has a non-zero exit code with a message containing the stderr of the process.
+ * Spawns a new process with an executable specified by `absolutePath` and waits until it returns. The return value is
+ * the stdout of the process. Throws if the program has a non-zero exit code with a message containing the stderr of the
+ * process.
*
* @param logger Logger to use.
* @param absolutePath Full path to the excutable.
* @param args Arguments to pass to the program. Can be {} if no arguments should be passed.
* @param std_in stdin input fo the program.
+ * @return stdout of the command
*/
enum class ExecOptions {
DropRoot
};
-void execAndWait(velia::Log logger, const std::string& absolutePath, std::initializer_list<std::string> args, std::string_view std_in, const std::set<ExecOptions> opts = {});
+std::string execAndWait(velia::Log logger, const std::string& absolutePath, std::initializer_list<std::string> args, std::string_view std_in, const std::set<ExecOptions> opts = {});
}