Why does closing terminal emulator window terminate a bash process with SIGHUP trap changed not to terminate?
0
votes
3
answers
1641
views
In a bash shell in a terminal emulator window of lxterminal, I run
$ trap "echo hello" SIGHUP
$ kill -s HUP $$
hello
$
and then I close the terminal emulator window.
Does closing the terminal emulator window only cause SIGHUP sent to the controlling process i.e. the bash process?
Since the SIGHUP trap doesn't terminate the bash process, I expect the bash process isn't terminated, but why is the bash process actually terminated?
Same thing happen if I change the trap to
""
(ignore).
Terminal emulator matters. In bash running in a xterm window, setting trap to ""
will make a xterm window not closable, while setting trap to echo hello
can still close a xterm window.
Thanks.
Asked by Tim
(106440 rep)
Dec 30, 2018, 05:33 PM
Last activity: Mar 4, 2020, 06:17 PM
Last activity: Mar 4, 2020, 06:17 PM