#!/usr/bin/env python3
"""Double-forking server, the way a real `serve` daemon backgrounds itself.
The process sysg exec's forks a grandchild that binds the port and lives on,
then the parent exits 0 immediately. sysg's Child handle therefore refers to a
process that has already exited, while the actual worker is a live, re-parented
grandchild that the daemon holds no handle to.
"""
=
=
# Parent: exit at once. This is the process sysg spawned and waits on.
# Grandchild: detach and become the real, long-lived worker.
=
# Advertise the true worker PID so the harness can kill exactly this process.