1

I'm trying to debug why tmux processes still think they're attached when I close the terminal they live inside of, and I think I've discovered part of the problem; when I close a terminal window (CMD-W or clicking the little red button in the top left) it doesn't send SIGHUP! In fact, it only sends SIGEXIT. I discovered this using the script from this SO question. One of the posters gave a very different result from his OSX machine, however my terminal does not seem to want to play nicely.

Does anyone know how to make the terminal in OSX (I'm running 10.7.2) send the proper signals when exiting? Thanks!

Community
  • 1
  • 1
staticfloat
  • 6,752
  • 4
  • 37
  • 51
  • That script shows SIGHUP and SIGEXIT for me. What shell are you using? I don't know of a way to prevent Bash, the default shell, from receiving SIGHUP when the terminal is closed, unless it's somehow configured to ignore SIGHUP without using `trap` (or if something uses `trap` after you've run that script). Terminal closes the pty, and /usr/bin/login should send SIGHUP to the shell; then Terminal sends SIGHUP to the shell, waits a few seconds, then sends SIGKILL. I suppose if there was some kind of delay for a few seconds, it could kill Bash before it received the SIGHUP. But that's unlikely. – Chris Page Oct 24 '11 at 19:20
  • For reference, @staticfloat asked essentially the same question on AskDifferent: – Chris Page Oct 24 '11 at 19:33
  • I am using the default Terminal.app on OSX on 10.7.2, and I've removed all scripts running on login (.profile, .bashrc, /etc/profile, /etc/bashrc) to try and reduce confounding elements, but nothing changes the outcome. – staticfloat Oct 25 '11 at 03:54

0 Answers0