Open GoogleCodeExporter opened 9 years ago
There is also this effect:
Within mintty, start another:
mintty &
Then try to close the first - it won't but hang around until all child
terminals are closed.
(I had not reported this earlier because I was afraid a fix might affect the
application-controlled HUP interaction that I desired :).
I confirm this patch also fixes the close-blocking by a spawned terminal and
does not affect HUP control by embedded applications (like mintty -e mined....).
Original comment by towom...@googlemail.com
on 20 Feb 2012 at 1:17
Mintty quits on pty EOF (modulo the --hold setting), which is a deliberate and
I think valid design decision, so I don't accept that this is a defect.
Arguably it makes more sense than quitting on child process exit, because other
processes still connected to the pty might still want to write to it. The
Windows console window and hence the Cygwin console behave likewise. Ssh
sessions also finish on pty EOF rather than child exit.
If you don't want a process to hold up mintty quitting, you can invoke it
through the 'setsid' utility from the util-linux package to put it into its own
session. Also, you can of course quit mintty with the close button or Alt+F4
shortcut.
Having said all that, you are of course right that xterm and other X terminal
emulators quit on child exit, and that mintty used to behave the same way.
Apparently it would save a few complaints if that was reinstated.
The trigger for the design change was issue 215: mintty was occasionally left
open because the SIGCHLD signal wasn't always being delivered, and that
appeared to be connected to mintty's use of the /dev/windows device.
At the time, I did consider what you're suggesting with the patch here, but
decided against it because it means polling the global process table with
waitpid() after every bit of output and every Windows event, and I was wary
about the impact that might have.
I'll need to investigate whether the issue with the unreliable SIGCHLD is still
there after the changes in Cygwin 1.7.10, and produce a small test case to take
to the Cygwin list if it is (which of course I should have done before). Don't
let me stop you if you want to have a go at this.
Original comment by andy.koppe
on 8 May 2012 at 5:07
Mintty's current behavior irks me to the point of building and running a
patched mintty all the time. Maybe it's long experience, but the traditional
xterm behavior feels right to me because it gives me more explicit control over
when a session ends.
I've been using this patch for months with no ill effects and no noticeable
performance problems. The process table is small and polling it isn't a problem
in practice, even with quite a few mintty instances. I also haven't noticed any
SIGCHLD losses in any program I've used.
Original comment by dan.cola...@gmail.com
on 8 May 2012 at 8:18
If A forks B, the discussion considers how A or its parent terminal might
behave when A is asked to close.
On the other hand, if B is a terminal, one could arguably expect it to detach
itself from the controlling tty, because there is no logical relation between
them (except maybe for debugging output...)
I think I remember a discussion claiming this long ago...
So I checked the sources and xterm does indeed have some calls to setsid but
only under obscure #ifdefs, and in fact, on cygwin or SunOS it does not detach
from the tty. Mintty also has a setsid call but that seems to be used for
something else.
So my suggestion for mintty (and terminals in general) would be to detach
itself when started (similar to "daemonizing").
Original comment by towom...@googlemail.com
on 23 May 2012 at 11:30
Thomas, I think mintty's own behaviour with regards to its parent process is a
related but separate issue.
Dan, the missing SIGCHLDs causing issue 215 appeared to be specifc to using
select() on /dev/windows, so indeed I wouldn't expect them with the polling
approach.
Original comment by andy.koppe
on 29 May 2012 at 11:46
Applied patch, thanks. See https://github.com/mintty/mintty/issues/319
Original comment by towom...@googlemail.com
on 21 Jul 2015 at 1:04
Original issue reported on code.google.com by
dan.cola...@gmail.com
on 6 Feb 2012 at 5:01