summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/kit/file.h1
-rw-r--r--source/kit/input_buffer.h1
-rw-r--r--source/kit/process.h52
-rw-r--r--source/kit/process.posix.c1
-rw-r--r--source/kit/process.win32.c1
-rw-r--r--source/kit/secure_random.c2
-rw-r--r--source/kit/secure_random.h2
-rw-r--r--source/kit/sockets.h1
-rw-r--r--source/kit/status.h2
-rw-r--r--source/kit/string_builder.h1
-rw-r--r--source/kit/unival.h1
-rw-r--r--source/kit/xml.h1
-rw-r--r--source/tests/_exe.c1
-rw-r--r--source/tests/process.test.c11
14 files changed, 71 insertions, 7 deletions
diff --git a/source/kit/file.h b/source/kit/file.h
index 79bc574..a02d135 100644
--- a/source/kit/file.h
+++ b/source/kit/file.h
@@ -2,7 +2,6 @@
#define KIT_FILE_H
#include "dynamic_array.h"
-#include "status.h"
#include "string_builder.h"
#include <stdio.h>
diff --git a/source/kit/input_buffer.h b/source/kit/input_buffer.h
index 2a7c8a7..0114e3c 100644
--- a/source/kit/input_buffer.h
+++ b/source/kit/input_buffer.h
@@ -3,7 +3,6 @@
#include "string_builder.h"
#include "input_stream.h"
-#include "status.h"
#ifdef __cplusplus
extern "C" {
diff --git a/source/kit/process.h b/source/kit/process.h
new file mode 100644
index 0000000..4a56055
--- /dev/null
+++ b/source/kit/process.h
@@ -0,0 +1,52 @@
+// TODO
+//
+
+#ifndef KIT_PROCESS_H
+#define KIT_PROCESS_H
+
+#include "types.h"
+#include "string_ref.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ s32 status;
+ i32 exit_code;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#else
+#endif
+} kit_process_t;
+
+typedef struct {
+ kit_str_t name;
+ kit_str_t value;
+} kit_process_env_var_t;
+
+typedef KIT_AR(kit_str_t) kit_process_args_t;
+typedef KIT_AR(kit_process_env_var_t) kit_process_env_t;
+
+typedef struct {
+ kit_str_t file_name;
+ kit_process_args_t command_line;
+ kit_process_env_t environment;
+ kit_str_t working_directory;
+} kit_process_info_t;
+
+s32 kit_process_init(kit_process_t *p, kit_process_info_t info);
+
+i64 kit_process_write_stdin(kit_process_t *p, kit_str_t in_data);
+i64 kit_process_read_stdout(kit_process_t *p, kit_str_t out_data);
+i64 kit_process_read_stderr(kit_process_t *p, kit_str_t out_data);
+s32 kit_process_terminate(kit_process_t *p);
+s32 kit_process_wait(kit_process_t *p);
+
+#ifdef __cplusplus
+}
+#endif
+
+#ifndef KIT_DISABLE_SHORT_NAMES
+#endif
+
+#endif
diff --git a/source/kit/process.posix.c b/source/kit/process.posix.c
new file mode 100644
index 0000000..aaf2a9f
--- /dev/null
+++ b/source/kit/process.posix.c
@@ -0,0 +1 @@
+#include "process.h"
diff --git a/source/kit/process.win32.c b/source/kit/process.win32.c
new file mode 100644
index 0000000..aaf2a9f
--- /dev/null
+++ b/source/kit/process.win32.c
@@ -0,0 +1 @@
+#include "process.h"
diff --git a/source/kit/secure_random.c b/source/kit/secure_random.c
index 2565f6f..2f53866 100644
--- a/source/kit/secure_random.c
+++ b/source/kit/secure_random.c
@@ -1,5 +1,7 @@
#include "secure_random.h"
+#include "status.h"
+
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/source/kit/secure_random.h b/source/kit/secure_random.h
index fbee23d..bfcbf98 100644
--- a/source/kit/secure_random.h
+++ b/source/kit/secure_random.h
@@ -1,7 +1,7 @@
#ifndef KIT_SECURE_RANDOM_H
#define KIT_SECURE_RANDOM_H
-#include "status.h"
+#include "types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/source/kit/sockets.h b/source/kit/sockets.h
index 1fe2a3d..276ecc5 100644
--- a/source/kit/sockets.h
+++ b/source/kit/sockets.h
@@ -1,6 +1,7 @@
#ifndef KIT_SOCKETS_H
#define KIT_SOCKETS_H
+#include "types.h"
#include "status.h"
#ifndef KIT_DISABLE_SYSTEM_SOCKETS
diff --git a/source/kit/status.h b/source/kit/status.h
index 6316704..9d1eb70 100644
--- a/source/kit/status.h
+++ b/source/kit/status.h
@@ -1,8 +1,6 @@
#ifndef KIT_STATUS_H
#define KIT_STATUS_H
-#include "types.h"
-
enum {
KIT_OK = 0,
KIT_PARSING_FAILED = 1,
diff --git a/source/kit/string_builder.h b/source/kit/string_builder.h
index 3f244e8..2cca27a 100644
--- a/source/kit/string_builder.h
+++ b/source/kit/string_builder.h
@@ -56,6 +56,7 @@ static s32 kit_str_append(kit_str_builder_t *a, kit_str_t b) {
#ifndef KIT_DISABLE_SHORT_NAMES
# define str_builder_t kit_str_builder_t
+# define str_build kit_str_build
# define str_append kit_str_append
#endif
diff --git a/source/kit/unival.h b/source/kit/unival.h
index 905430b..63868d5 100644
--- a/source/kit/unival.h
+++ b/source/kit/unival.h
@@ -1,7 +1,6 @@
#ifndef KIT_UV_H
#define KIT_UV_H
-#include "status.h"
#include "string_builder.h"
#include "input_stream.h"
diff --git a/source/kit/xml.h b/source/kit/xml.h
index 755a918..fab1d1d 100644
--- a/source/kit/xml.h
+++ b/source/kit/xml.h
@@ -1,7 +1,6 @@
#ifndef KIT_XML_H
#define KIT_XML_H
-#include "status.h"
#include "string_builder.h"
#include "input_stream.h"
diff --git a/source/tests/_exe.c b/source/tests/_exe.c
index 99a34b8..cf310b0 100644
--- a/source/tests/_exe.c
+++ b/source/tests/_exe.c
@@ -7,6 +7,7 @@
#include "condition_variable.test.c"
#include "dynamic_array.test.c"
#include "file.test.c"
+#include "process.test.c"
#include "input_buffer.test.c"
#include "input_stream.test.c"
#include "lower_bound.test.c"
diff --git a/source/tests/process.test.c b/source/tests/process.test.c
new file mode 100644
index 0000000..44f41a5
--- /dev/null
+++ b/source/tests/process.test.c
@@ -0,0 +1,11 @@
+#include "../kit/process.h"
+
+#define KIT_TEST_FILE process
+#include "../kit/test.h"
+
+TEST("process run") {
+ // TODO
+ //
+}
+
+#undef KIT_TEST_FILE