Why does sudo-ed terminal process does not end when console is terminated?

A process, which does not ignore SIGHUP or any terminal signal, does not terminate when the terminal is closed in a desktop session.

 Steps to reproduce :

1.    Open the terminal from GUI

2.    Run this executable as sudo

int main () 
{ 
while(1); 
return 0;
} 

3. Close the terminal

After step 3, process continues to run.

NOTE: When the same steps are run from an SSH Terminal (Putty Session), the process ends when the terminal is closed.

Might skim the following, and see if it helps:

... https://apple.stackexchange.com/questions/384216/closing-terminal-window-does-not-kill-script-run-with-sudo

Why does sudo-ed terminal process does not end when console is terminated?
 
 
Q