`Close tab?` prompt not coming up if .bashrc is not finished executing
Normally we have a
Warning
Close tab?
There is still a process running.
Closing this tab will kill it.
dialog box that comes up if there is still a running process inside the terminal.
However, if the .bashrc
script is not finished when you try to close the terminal tab, this prompt won't come up.
I've encountered this because I'm using the script
command in my .bashrc
script to record all terminal output, so my .bashrc
script never finishes until I type exit
in the shell. I'd like the prompt to come up all the time, regardless of whether the .bashrc
is finished or not. Instead, it just seems to hard kill everything in the tab and loose the bash history.
Note: Since script
launches the .bashrc
when it starts, you'll need a more complicated .bashrc
script to use script
within it so that it doesn't get in an infinite loop, so just adding something simple like htop
or man man
at the end of your .bashrc
is an easier way to test this issue.
Also: If you open 2 tabs and try to close the entire window, there is always a prompt regardless of whether .bashrc
has finished or not.