delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/07/12/23:42:35

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
Message-Id: <5.1.0.14.2.20020712192916.02a59358@pop3.cris.com>
X-Sender: rrschulz AT pop3 DOT cris DOT com
Date: Fri, 12 Jul 2002 20:43:40 -0700
To: "Shane Brooks" <shane_brooks AT email DOT com>, cygwin AT cygwin DOT com
From: Randall R Schulz <rrschulz AT cris DOT com>
Subject: Re: close cygwin window - bash doesnt save history
In-Reply-To: <20020713021352.13301.qmail@email.com>
Mime-Version: 1.0

Shane,

I don't think "huponexit" should have any effect on whether this technique 
works.

My guess at what you see flash by is the diagnostic that "myclosefn" cannot 
be found (you defined "myclose" and set "myclosefn" as the trap action!).


I still can't make this work. Did I hallucinate that first success?

What I _do_ think is that SIGHUP is not generated when a BASH console 
window is closed.

I tried it running in RXVT. It does a whole different funky thing: When I 
close the window, the trapped function is executed in an infinite loop and 
BASH never exits. This _is_ repeatable.

I just as baffled as before, if not more so.

Randall Schulz
Mountain View, CA USA


At 19:13 2002-07-12, Shane Brooks wrote:
>From: Randall R Schulz <rrschulz AT cris DOT com>
> > (*) In further investigating options using "trap," I discovered I can no
> > longer repeat my earlier success, regardless of whether I use "tty" or not.
>
>I used "history -a" , but it appears the trap is being called when the 
>window closes as I can call "myclosefn" OK.  I have been typing this at 
>the BASH command prompt, not editing a .bash_login or profile. So my 
>session looks like..
>
>Shane AT GUINNESS ~
>$ myclose () {
> > history -a
> > }
>
>Shane AT GUINNESS ~
>$ trap myclosefn SIGHUP
>
>Shane AT GUINNESS ~
>$
>
>using shopt I see that the builtin command huponexit is OFF, but that 
>should be OK shouldnt it?  the man page suggests huponexit allows tasks 
>that are not in the job table to recieve the SIGHUP also.
>
>from the man page "When Bash receives a signal for which a trap has been 
>set while waiting for a command to complete, the trap will not be executed 
>until the command completes." - perhaps under windows its too late once 
>the command has completed?  ie the window is already closed?
>
>Interestingly I see something flash onto the command line just before the 
>window closes..but my machine is too fast to allow me to read it.


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019