SIGHUP
A hangup signal in Unix/Linux systems, sent to relevant processes when a terminal connection is disconnected. Its default behavior is to terminate the process, so programs that must survive terminal disconnection need to ignore or handle this signal explicitly.
Timeline (last 90 days)
Any application architecture that wants agents to outlive the terminal window should include: a separate long-lived process in its own session that ignores SIGHUP, holding the agent's pty master, with the UI connecting as a client over a socket, buffering output when no one is attached, replacing the UI binary without affecting the running host, and the host exiting on its own once there are no sessions.
If a process group becomes an orphaned group and a member of it is in a stopped state, POSIX specifies that the system sends SIGHUP and SIGCONT to all members of that group.
Before exiting after receiving SIGHUP, bash resends SIGHUP to all of its running or stopped jobs.
On macOS since 10.15, the HUP option of the default login shell zsh is on by default, sending SIGHUP to running jobs when the shell exits.
When a terminal window is closed, the kernel sends SIGHUP to the session leader process (usually the shell), which then forwards that SIGHUP to the jobs in its job table, causing the AI coding agent process to terminate.
nohup works by setting SIGHUP to be ignored, so that a background process is not terminated by SIGHUP when the terminal closes.
disown removes the job from the shell's job table, so when the shell receives SIGHUP it has no job to forward, and the process therefore does not receive SIGHUP.
setsid makes a process run in an independent session with no controlling terminal, thereby avoiding SIGHUP when the terminal hangs up.
The tmux session process actively detaches from the controlling terminal (becoming a daemon), so it is not affected by the SIGHUP signal.
The nohup command achieves simple background persistence by making the process ignore the SIGHUP signal.
1 more timeline events
All Facts (11)
Any application architecture that wants agents to outlive the terminal window should include: a separate long-lived process in its own session that ignores SIGHUP, holding the agent's pty master, with the UI connecting as a client over a socket, buffering output when no one is attached, replacing the UI binary without affecting the running host, and the host exiting on its own once there are no sessions.
50%UnverifiedIf a process group becomes an orphaned group and a member of it is in a stopped state, POSIX specifies that the system sends SIGHUP and SIGCONT to all members of that group.
50%UnverifiedBefore exiting after receiving SIGHUP, bash resends SIGHUP to all of its running or stopped jobs.
50%UnverifiedOn macOS since 10.15, the HUP option of the default login shell zsh is on by default, sending SIGHUP to running jobs when the shell exits.
50%UnverifiedWhen a terminal window is closed, the kernel sends SIGHUP to the session leader process (usually the shell), which then forwards that SIGHUP to the jobs in its job table, causing the AI coding agent process to terminate.
50%Unverifiednohup works by setting SIGHUP to be ignored, so that a background process is not terminated by SIGHUP when the terminal closes.
50%Unverifieddisown removes the job from the shell's job table, so when the shell receives SIGHUP it has no job to forward, and the process therefore does not receive SIGHUP.
50%Unverifiedsetsid makes a process run in an independent session with no controlling terminal, thereby avoiding SIGHUP when the terminal hangs up.
50%UnverifiedThe tmux session process actively detaches from the controlling terminal (becoming a daemon), so it is not affected by the SIGHUP signal.
50%UnverifiedThe nohup command achieves simple background persistence by making the process ignore the SIGHUP signal.
50%UnverifiedWhen a terminal window is closed, all child processes running within it receive a SIGHUP signal and terminate.
50%