Cygwin prevents normal Windows shutdown

Randall R Schulz rschulz@sonic.net
Thu Jul 24 00:45:00 GMT 2003


Richard,

For starters, you're sending two copies of your messges (some of them, 
anyway), both a To: copy and a CC: copy. Please try to avoid that.


At 15:19 2003-07-23, Richard Anderson wrote:
>----- Original Message -----
>From: "Igor Pechtchanski" <pechtcha@cs.nyu.edu>
>To: "Richard Anderson" <richard@richard-anderson.org>
>Cc: <cygwin@cygwin.com>
>Sent: Wednesday, July 23, 2003 2:34 PM
>Subject: Re: Cygwin prevents normal Windows shutdown
>
>
> > On Mon, 21 Jul 2003, Richard Anderson wrote:
> >
> > > When I start Cygwin 1.3.22-1 with the installed shortcut (which points to
> > > C:\cygwin\cygwin.bat) and then try to shut down Windows XP using 
> the normal
> > > Start / Turn Off Computer procedure, Windows pops up the "End Program -
> > > Cygwin ... Windows cannot end this program" dialog box.  The cygwin ps
> > > command shows only a bash shell running.
> > >
> > > Is there some way to prevent this behavior?
> > > Richard Anderson
> >
> > Richard,
> >
> > Apparently, bash doesn't react to the shutdown message that Windows XP
> > sends it.  I've observed similar behavior with Windows 9x.  Can you close
> > the bash window via the 'X' ("Close") button?  If not, then it's possible
> > that the correct WM_CLOSE message simply isn't passed to or handled by the
> > bash shell (and any other console Cygwin process).  On Windows NT/2k,
> > using the 'X' button sends a HUP signal to the shell.  This doesn't seem
> > to happen on Windows 9x (and, possibly, Windows XP -- I don't have an XP
> > system to test this on).  You could try to incite someone knowledgeable in
> > Windows messaging (not me, sorry) to investigate this further.
> > Igor
>
>Igor,
>
>Windows XP and 2K are derived the same code base (or at least more so 
>than 2K and 98), so most systems calls should behave the same.  The 
>bash window closes normally when I click the Close button.  All 
>third-party Windows apps I have used except Cygwin show the normal 
>behavior on Windows - they gracefully exit without invoking the End 
>Process pop-up.  So it's likely that Cygwin is not following the 
>Windows API standard for catching and handling this interrupt.

The so-called "BASH window" may close "normally" when you click the 
close box or type ALT-F4, but it is an abortive termination. You'll 
find, for example, that if you have set up your BASH options so it 
saves its history that this is not happening when you close the window 
in this manner. You must use "logout" (acceptable only if the shell is 
marked as a login shell) or "exit" (alwasy OK) lest you forgo all of 
BASH's normal shutdown processing.

Appeals to the behavior of other "third-party" Windows applications are 
not entirely irrelevant, but also not directly applicable. Cygwin 
produces a POSIX emulation environment, and while it does so very well, 
it is not an entirely seamless melding of the two operating environments.

As has been stated already, if you'd like to make (as opposed to 
suggest) an improvement, work on a way to send SIGHUP to processes when 
their windows are closed or when Windows sends one of its shutdown messages.

I don't have to power to give them out, but a patch that is accepted or 
becomes the basis for an adopted enhancement to Cygwin could well earn 
you a gold star.


>Richard Anderson


Randall Schulz 


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list