summaryrefslogtreecommitdiff
path: root/editor/editor.cpp
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-12-18 20:35:37 -0500
committerJonathan Bradley <jcb@pikum.xyz>2023-12-23 11:41:03 -0500
commitc7c678651a30db30e449e965e6c82ad0dcb871e6 (patch)
tree09f012460a7f77bb92d82d642ec0e9d85ef347e2 /editor/editor.cpp
parent4c4304429a4c06167aa21de246aa21e7b3ceb725 (diff)
checkpoint - arg-handler
Diffstat (limited to 'editor/editor.cpp')
-rw-r--r--editor/editor.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/editor/editor.cpp b/editor/editor.cpp
index 53d8883..4170ac9 100644
--- a/editor/editor.cpp
+++ b/editor/editor.cpp
@@ -105,16 +105,24 @@ void PkeEditor_Tick(double delta) {
PkeThreads_Enqueue(threadPoolHandle, std::packaged_task<void()>( [] {
auto pid = fork();
if (pid == 0) {
+ char pluginOpt[128];
+ pluginOpt[127] = '\n';
+ sprintf(pluginOpt, "--plugin %s", pkeSettings.pluginPath == nullptr ? "example.o" : pkeSettings.pluginPath);
+ int status = -1;
const char *argv[] = {
+ pluginOpt,
NULL,
};
- int status = execvp("pke_runtime", const_cast<char **>(argv));
- fprintf(stderr, "pke_runtime exited with a status of %i\n", status);
+ status = execvp("pke_runtime", const_cast<char **>(argv));
+ fprintf(stderr, "pke_runtime (child) exited with a status of %i\n", status);
+ subProgramRunning = false;
+ } else if (pid == -1) {
+ fprintf(stdout, "pke_runtime failed to fork\n");
subProgramRunning = false;
} else {
- int status;
+ int status = 0xCAFEBABE;
waitpid(pid, &status, 0);
- fprintf(stdout, "pke_runtime exited cleanly with a status of %i\n", status);
+ fprintf(stdout, "pke_runtime (parent) exited with a status of %i (0x%08X)\n", status, status);
subProgramRunning = false;
}
}));