This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: close cygwin window - bash doesnt save history


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 <>
> (*) 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..

$ myclose () {
> history -a
> }

$ trap myclosefn SIGHUP


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:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]