From 368e6adcd48f1e45635293fdd8c303869296a804 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Wed, 12 Aug 2026 16:22:58 +0900 Subject: [PATCH] fix: keep the headless daemon running --- main.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 351ad03..45fd1b9 100644 --- a/main.c +++ b/main.c @@ -10,7 +10,8 @@ char *fontdir; int threadmaybackground(void) { - return 1; + /* Keep the launcher PID stable so supervisors can own this daemon. */ + return 0; } void @@ -57,6 +58,9 @@ erealloc(void *p, ulong n) void threadmain(int argc, char **argv) { + Channel *waitc; + uchar stop; + if(argc != 3) usage(); @@ -80,5 +84,7 @@ threadmain(int argc, char **argv) if(threadcreate(imthread, nil, 16384) < 0) die("can't create input worker"); - threadexits(nil); + /* Keep the supervising process and its externally visible PID alive. */ + waitc = chancreate(sizeof stop, 0); + chanrecv(waitc, &stop); }