863 B
863 B
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
/* The kreuzberg C FFI does not embed the MCP server. Spawn the kreuzberg
* CLI from a host process that uses libkreuzberg for in-process extraction. */
int main(void) {
pid_t pid = fork();
if (pid < 0) {
perror("fork");
return 1;
}
if (pid == 0) {
execlp("kreuzberg", "kreuzberg", "mcp", (char *)NULL);
perror("execlp");
_exit(127);
}
int status = 0;
if (waitpid(pid, &status, 0) < 0) {
perror("waitpid");
return 1;
}
return WIFEXITED(status) ? WEXITSTATUS(status) : 1;
}