Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#12386 closed bug (no change required)

Terminal: launching apps in the background no longer detaches them from the shell

Reported by: stippi Owned by: axeld
Priority: normal Milestone: Unscheduled
Component: System/Kernel Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All


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...

Change History (3)

comment:1 Changed 4 years ago by bonefish

Resolution: no change required
Status: newclosed

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.

comment:2 Changed 4 years ago by stippi

Thanks for taking the time to explain. I will relearn my habits and use the vulcan death grip and Restart the desktop from there...

comment:3 Changed 4 years ago by jessicah

You can just use open /system/Tracker. This has the exact behaviour you're desiring.

Note: See TracTickets for help on using tickets.