pub fn launch_session_handling_sigterm(
staged: StagedSession,
on_url: impl FnOnce(&str),
) -> Result<LaunchResult, RuntimeError>Expand description
launch_session for a process whose lifetime is this one session.
On unix an agent session takes SIGTERM over for the rest of the process: the first signal
cancels every live task and ends the session through its normal teardown, a second exits at
once with status 143, and [TERMINATE_TEARDOWN_DEADLINE] after the first the process exits
with status 143 whatever it is doing. Those exits end the whole process, so nothing that
outlives the session may share it. A script capsule, or a platform without SIGTERM, launches
exactly as launch_session does.
It is also the one launch that honours a lifeline:
- A formation lifeline (
StagedSession::attach_formation_lifeline): EOF on it begins the same termination a firstSIGTERMdoes, after appendingformation_endedto the trace, and never counts as aSIGTERM. Every other launch of a session holding one, and this one for a script capsule, is refused withRuntimeError::FormationLifelineUnreadable. - A spawner lifeline (
StagedSession::attach_spawner_lifeline): on an agent capsule, EOF on it begins that termination after appendingspawner_ended, on the same terms. A script capsule takes noSIGTERMhandler, so there EOF does what aSIGTERMdoes to it: the process exits with status 143. Every other launch of a session holding one is refused withRuntimeError::SpawnerLifelineUnreadable.
Whichever lifeline closes first while nothing else has begun the termination is the one whose record is written.