Stop Darling on Ctrl+C, terminal hangup and darling-lol --stop

After the clients quit, the session kept Darling running: Riot and League
crash handlers never exit under Darling, and the idle check counted them as
clients. Ctrl+C or closing the terminal killed bubblewrap, whose
--die-with-parent then killed nix-lifecycle.py before it could shut Darling
down, which left a live server marker behind.

- nix-idle.py ignores crash handlers when deciding whether a client still
  uses the prefix.
- The launcher starts bubblewrap with INT, QUIT, HUP and TERM ignored, and
  env restores them inside. The supervisor turns them into a stop request.
- nix-lifecycle.py polls for a signal or stop request and then shuts Darling
  down without waiting for clients. It stops retrying a failed shutdown once
  the server is gone, and waits for or kills its own command afterwards.
- darling-lol --stop makes the stop request and waits for the session. If
  the session does not exit within 30 seconds, or no session holds the lock,
  it kills the prefix's darlingserver and launchd like darling shutdown,
  after checking that the marker PID is this user's darlingserver for this
  prefix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
David GhegheaandClaude Opus 5.5 committed 2026-10-18 17:14:26 +02:00
1 parent c943a19606
commit 033ded4fd6
7 files changed
+318 -26

No files matched your search

+10 -3
View File
@@ -57,8 +57,15 @@ for prompts and session output.
Keep the terminal open while clients are running and until cleanup completes.
Default and installer sessions wait for clients to exit, then shut Darling down
in the same namespace. A failed shutdown is retried without discarding that
namespace.
in the same namespace. Crash handlers do not count as clients, because they do
not exit on their own under Darling. A failed shutdown is retried without
discarding that namespace.
To end a session while clients are still running, press Ctrl+C in its terminal,
close the terminal, or run `darling-lol --stop` from anywhere. Each of these
makes the session shut Darling down and exit. If the session does not exit
within 30 seconds, `darling-lol --stop` kills the prefix's `darlingserver`
itself. It also stops a server that outlived its session.
## Install permanently
@@ -198,7 +205,7 @@ nix run github:lucannez64/darling-lol#shell
Use the launcher-provided shell rather than entering the raw FHS environment.
If you start Darling manually in this shell, run `darling shutdown` there
before exiting. A separately launched shell cannot reconnect to an existing
Darling namespace.
Darling namespace; `darling-lol --stop` can still stop it.
## Files and operational limits