When I'm launching a background process and then closes the terminal using the window's closing button, the background process gets killed. However if I close the terminal using Ctrl+D, the background process keeps running:
sam@Sam-Pc:~$ yes > /dev/null &
[1] 10219
// I then close the terminal a reopen a new one
sam@Sam-Pc:~$ ps aux | grep yes
sam 10295 0.0 0.0 15948 2152 pts/8 S+ 00:54 0:00 grep --color=auto yes
And now using Ctrl+D to close the terminal:
sam@Sam-Pc:~$ yes > /dev/null &
[1] 10299
sam@Sam-Pc:~$Ctrl-D
// I then reopen a new terminal
sam@Sam-Pc:~$ ps aux | grep yes
sam 10219 99.4 0.0 11404 812 ? R 00:52 2:01 yes
sam 10295 0.0 0.0 15948 2152 pts/8 S+ 00:54 0:00 grep --color=auto yes
Could anybody explain this behaviour?
Thanks!