Mercurial
view seobeo/tests/seobeo_sigpipe_test.c @ 271:13d61401c57d
redirect Copilot cache to service state
Set XDG_CACHE_HOME from the configured inference state so the systemd service can extract Copilot outside its protected home directory.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 07 Aug 2026 13:24:05 -0700 |
| parents | 0e7b9464248d |
| children |
line wrap: on
line source
#include "seobeo/seobeo.h" #include <signal.h> #include <stdlib.h> #include <sys/socket.h> int main(void) { Seobeo_Handle *server = Seobeo_Stream_Handle_Server_Create("127.0.0.1", "0"); if (!server) return 1; raise(SIGPIPE); Seobeo_Handle_Destroy(server); int sockets[2]; if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) != 0) return 1; Seobeo_Handle handle = {0}; handle.socket = sockets[0]; handle.write_buffer_capacity = 64; handle.write_buffer = malloc(handle.write_buffer_capacity); if (!handle.write_buffer) return 1; close(sockets[1]); if (Seobeo_Handle_Queue(&handle, (const uint8 *)"closed", 6) != 0) return 1; int result = Seobeo_Handle_Flush(&handle); close(sockets[0]); free(handle.write_buffer); return result < 0 ? 0 : 1; }