aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/process.h
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2022-08-26 05:07:32 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2022-08-26 05:07:32 +0200
commita593789a46ceb27d26186db7b3215b2a046ff865 (patch)
tree978ac4dbf25e1b9fb7da8299d1abb9514017420a /src/process.h
parentadd some more code (diff)
downloadcimple-a593789a46ceb27d26186db7b3215b2a046ff865.tar.gz
cimple-a593789a46ceb27d26186db7b3215b2a046ff865.zip
worker: capture process output
Diffstat (limited to '')
-rw-r--r--src/process.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/process.h b/src/process.h
index da0c421..455d4ec 100644
--- a/src/process.h
+++ b/src/process.h
@@ -1,6 +1,21 @@
#ifndef __PROCESS_H__
#define __PROCESS_H__
+#include <stddef.h>
+
+struct proc_output {
+ int ec;
+ char *output;
+ size_t output_len;
+};
+
+/* The exit code is only valid if the functions returns a non-negative number. */
int proc_spawn(const char *args[], int *ec);
+/* Similarly, the contents of the proc_output structure is only valid if the function returns a
+ * non-negative number.
+ *
+ * In that case, you'll need to free the output. */
+int proc_capture(const char *args[], struct proc_output *result);
+
#endif