Mail Archives: cygwin/2010/02/27/20:28:42
Thomas Wolff wrote:
> In general, a GUI application started in the background, like a terminal,
> should detach itself from its parent process so that it survives if the
> parent is terminated.
Says who? You can always invoke it with setsid or some such to detach it.
> I've noticed the following sometimes surprising inconsistencies about thi=
s:
>
> mintty
> =C2=A0 =C2=A0 =C2=A0 =C2=A0xterm &
> =C2=A0 =C2=A0 =C2=A0 =C2=A0mintty &
> =C2=A0 =C2=A0 =C2=A0 =C2=A0Close/Alt-F4
> =C2=A0 =C2=A0 =C2=A0 =C2=A0-> dialog "Processes are running in session. E=
xit anyway?"
> =C2=A0 =C2=A0 =C2=A0 =C2=A0OK
> =C2=A0 =C2=A0 =C2=A0 =C2=A0-> xterm remains
> =C2=A0 =C2=A0 =C2=A0 =C2=A0-> mintty is killed
> xterm
> =C2=A0 =C2=A0 =C2=A0 =C2=A0xterm &
> =C2=A0 =C2=A0 =C2=A0 =C2=A0mintty &
> =C2=A0 =C2=A0 =C2=A0 =C2=A0Close/Quit
> =C2=A0 =C2=A0 =C2=A0 =C2=A0-> xterm remains
> =C2=A0 =C2=A0 =C2=A0 =C2=A0-> mintty is killed
Mintty has default handling for SIGHUP, i.e. it exits. Same for rxvt.
Xterm presumably chooses to ignore it.
> mintty
> =C2=A0 =C2=A0 =C2=A0 =C2=A0xterm &
> =C2=A0 =C2=A0 =C2=A0 =C2=A0mintty &
> =C2=A0 =C2=A0 =C2=A0 =C2=A0exit
> =C2=A0 =C2=A0 =C2=A0 =C2=A0-> all child terminals remain
> xterm
> =C2=A0 =C2=A0 =C2=A0 =C2=A0xterm &
> =C2=A0 =C2=A0 =C2=A0 =C2=A0mintty &
> =C2=A0 =C2=A0 =C2=A0 =C2=A0exit
> =C2=A0 =C2=A0 =C2=A0 =C2=A0-> all child terminals remain
I don't understand why there isn't a SIGUP in these cases.
> cygwin console
> =C2=A0 =C2=A0 =C2=A0 =C2=A0xterm &
> =C2=A0 =C2=A0 =C2=A0 =C2=A0mintty &
> =C2=A0 =C2=A0 =C2=A0 =C2=A0exit/Alt-F4
> =C2=A0 =C2=A0 =C2=A0 =C2=A0-> console hangs
It's not really hanging; it's just waiting for xterm to finish. Xterm
is linked as a console subsystem program, which means at startup it
attaches to its parent's console (or opens its own if there isn't
one). Consoles stay open as long as there's at least one process
attached to them.
Mintty, meanwhile, is a GUI subsystem program, which means it doesn't
attach to or open a console.
> =C2=A0 =C2=A0 =C2=A0 =C2=A0Close
> =C2=A0 =C2=A0 =C2=A0 =C2=A0-> mintty remains
> =C2=A0 =C2=A0 =C2=A0 =C2=A0-> xterm is killed
When a console is closed, Windows kills all processes attached to it.
> Also, mintty can be protected from being killed by spawning it with
> (mintty&)
> while xterm, spawned this way from a cygwin console, still gets killed.
Yep, doing that doesn't break the console attachment.
Andy
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -