[plug] Xterms and bash and stuff: or, mysterious vanishing windows and mysterious vanishing stdin

Andrew Francis lists at sullust.net
Sat Nov 9 15:21:00 WST 2002


On Sat, Nov 09, 2002 at 01:03:04PM +0800, Cameron Patrick wrote:
> There's something that's often confused me about the way that Linux handles
> programs launched in the background.  Most of the time, you can start an X
> program in the background by typing something like 'xemacs &' in an xterm,
> close the xterm, and the Xemacs will still be there[1].  Occasionally,
> though, it disappears in a puff of smoke and nothing is ever heard from it
> again. Does anyone know what causes this?

Upon exiting, the shell sends xemacs a HUP signal. This is probably
causing it to kill itself.

You want the 'disown' command. From the bash(1) manpage:
       The  shell  exits  by  default  upon  receipt of a SIGHUP.
       Before exiting, an interactive shell resends the SIGHUP to
       all  jobs, running or stopped.  Stopped jobs are sent SIG-
       CONT to ensure that they receive the SIGHUP.   To  prevent
       the  shell from sending the signal to a particular job, it
       should be removed from the  jobs  table  with  the  disown
       builtin  (see  SHELL  BUILTIN COMMANDS below) or marked to
       not receive SIGHUP using disown -h.

-- 
Andrew Francis          | To email me, get | ASCII ribbon campaign ( ) 
Perth, Australia        | the real address |    against HTML email  X
http://www.sullust.net/ | from my homepage |   http://arc.pasp.de/ / \



More information about the plug mailing list