fix: keep the headless daemon running

This commit is contained in:
2026-08-12 16:22:58 +09:00
parent 5927f6a5e1
commit 368e6adcd4

10
main.c
View File

@@ -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);
}