In Haiku it actually works as it should (you can check that in Linux (e.g. try something like xeyes)). Many things regarding signals and terminal session handling weren't implemented correctly in BeOS. When you start a process from the shell -- regardless of whether you start it in the foreground or background -- it still belongs to the same (terminal) session as the shell and is managed by the shell as an active job. When the terminal is closed, SIGHUP is sent to the shell, which in turn propagates it to all active jobs. Unless a process handles/ignores the signal explicitly, it will thus be killed.
Several things can prevent that fate:
- Obviously handling/ignoring SIGHUP by the process itself. There's also a wrapper tool nohup, which will do that: nohup my-program & will ignore SIGHUP and redirect stdin (from /dev/null) and stdout (to a file).
- You can tell the shell to remove the job from its list of active jobs: my-program & disown. The shell won't propagate SIGHUP to the job anymore. However, that won't affect the process' stdin/out/err, so one usually wants to redirect those, too.
I did a quick Trac search, but maybe I am indeed the first to notice: In previous Haiku releases and on BeOS, it was possible to launch Tracker (and Deskbar) via /system/Tracker & and when quitting the Terminal, Tracker would continue to run. This is no longer the case. I am probably picking the wrong component...
Like the title says.