| www.delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT cygwin DOT com |
| Mail-Followup-To: | cygwin AT cygwin DOT com |
| Delivered-To: | mailing list cygwin AT cygwin DOT com |
| Date: | Wed, 10 Jul 2002 08:17:50 -0700 |
| From: | Dario Alcocer <alcocer AT helixdigital DOT com> |
| To: | cygwin AT cygwin DOT com |
| Subject: | Re: close cygwin window - bash doesnt save history |
| Message-ID: | <20020710081749.B99@ns.helixdigital.com> |
| References: | <20020710132952 DOT 55896 DOT qmail AT web13104 DOT mail DOT yahoo DOT com> |
| Mime-Version: | 1.0 |
| User-Agent: | Mutt/1.2.5.1i |
| In-Reply-To: | <20020710132952.55896.qmail@web13104.mail.yahoo.com>; from bbuchbinder@yahoo.com on Wed, Jul 10, 2002 at 06:29:52AM -0700 |
On Wed, Jul 10, 2002 at 06:29:52AM -0700, Barry Buchbinder wrote:
> Solution: Don't hit the 'X' button. Don't get out of
> bash by turn off the power, either. Use "logout" or
> "exit".
>
> Bash obviously does not save history after each
> command; it saves history when it shuts down. Hitting
> the 'X' button kills it without going through the
> normal shut down sequence.
Even better solution: register a signal handler in your Bash session
for SIGHUP; the cygwin1.dll sends a hangup signal when CTRL_CLOSE_EVENT
is received. Something like this:
$ myclosefn() {
echo "My close func got called." > $HOME/myclosefn.txt
# TODO: add more clean-up logic here
}
$ trap myclosefn SIGHUP
I've tested this, so I know it works.
P.S. BTW, I didn't know the answer to this beforehand, but instead
actually looked at the source. That's one of the beauties of open
source projects: questions like these can be answered by direct
inspection. "Read the Source, Luke!" ;-)
--
Dario Alcocer -- Sr. Software Developer, Helix Digital Inc.
alcocer AT helixdigital DOT com -- http://www.helixdigital.com
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |