summaryrefslogtreecommitdiff
path: root/editor/editor.cpp
diff options
context:
space:
mode:
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;
}
}));