Start each caller-facing process in its own job object and keep the sole
handle on the Process rather than handing a copy to the child. Terminate
now kills the whole job, the session's descendants too, like SIGKILL to a
Unix process group. If this tailscaled dies, the OS closes the last job
handle and kill-on-close terminates the tree, so a crashed service does
not leak a user's session processes, matching the Unix monitor's
termination on RPC loss. A graceful session end clears kill-on-close
first, so processes the user backgrounded survive.
The pseudoconsole relay keeps starting its shell without its own job, so
the shell joins the caller's job as before.
Updates #4697
Signed-off-by: Brad Fitzpatrick <[email protected]>
Change-Id: Ia3c7e9f1b5d2460a8c3e7f9b2d4a6c8e0f1b3d5a