summaryrefslogtreecommitdiff
path: root/hscript/util.hh
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-02 17:50:11 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2019-11-02 17:50:11 -0500
commit8871308c48dd59046c0e1e318486be04ff20c278 (patch)
tree3238a311c2df00b7e6aae235dfd89fc31669c0d2 /hscript/util.hh
parentff2044f3ce53f7c2bb7b34588adad0490bd3a808 (diff)
downloadhorizon-8871308c48dd59046c0e1e318486be04ff20c278.tar.gz
horizon-8871308c48dd59046c0e1e318486be04ff20c278.tar.bz2
horizon-8871308c48dd59046c0e1e318486be04ff20c278.tar.xz
horizon-8871308c48dd59046c0e1e318486be04ff20c278.zip
hscript: Factor out FS exec stuff to run_command function
Diffstat (limited to 'hscript/util.hh')
-rw-r--r--hscript/util.hh11
1 files changed, 11 insertions, 0 deletions
diff --git a/hscript/util.hh b/hscript/util.hh
index d350cd3..47da022 100644
--- a/hscript/util.hh
+++ b/hscript/util.hh
@@ -14,6 +14,7 @@
#define HSCRIPT_UTIL_HH
#include <string>
+#include <vector>
/*! Download the contents of a URL to a path.
* @param url The URL to download.
@@ -22,4 +23,14 @@
*/
bool download_file(const std::string &url, const std::string &path);
+/*! Run a command.
+ * @param cmd The command to run.
+ * @param args Arguments to pass to the command.
+ * @returns 0 if the command exited normally with status 0,
+ * the exit code if the command exited abnormally,
+ * -1 if the command signalled.
+ * @note Status of the command is output using +output_error+.
+ */
+int run_command(const std::string &cmd, const std::vector<std::string> &args);
+
#endif /* !HSCRIPT_UTIL_HH */