delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/02/20/06:36:55

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: Thu, 20 Feb 2003 11:35:50 +0000
Message-ID: <5420-Thu20Feb2003113550+0000-starksb@ebi.ac.uk>
From: David Starks-Browning <starksb AT ebi DOT ac DOT uk>
MIME-Version: 1.0
To: Jim Kleckner <jek-cygwin AT kleckner DOT net>
Cc: cygwin AT cygwin DOT com
Subject: rxvt dialog at shutdown suggests failure to exit due to ssh-agent?
In-Reply-To: <3E53C564.4070007@kleckner.net>
References: <3E53C564 DOT 4070007 AT kleckner DOT net>

On Wednesday 19 Feb 03, Jim Kleckner writes:
> Consistently when I shutdown Win2K I get a dialog
> asking to end an rxvt process:
>     End Program: rxvt00000510
>     Windows cannot end this program.  It may need
>     more time to complete an operation. ...
>     End Now/Cancel
> 
> I launch rxvt via an rxvt.lnk that contains
> the following as the "Target":
>    C:\cygwin\bin\rxvt.exe -e bash.exe -i
> I typically launch two instances of rxvt so
> that I can toggle from one to the other.  Prior
> to shutdown, I type exit into each shell and the
> window closes.  ...  I use keychain and ssh-agent
> is still running.  If I shut down ssh-agent
> with "keychain -k" prior to exiting the bash
> shells, then shutdown proceeds properly.
> 
> Is there a way for keychain to launch ssh-agent
> such that it doesn't cause this hang?

(caveat: I don't use Win2K and I don't use keychains, and I don't know
precisely how keychains work.  Presumably it just manages ssh-agent
and ssh-add.)

I don't know how to "launch ssh-agent such that it doesn't cause this
hang".  But I do know how to kill ssh-agent automatically when you
exit a shell.  Just add:

	trap 'test -n "$SSH_AGENT_PID" && eval `ssh-agent -k`' EXIT

to your .bash_profile (or whatever).  Actually, the test for
$SSH_AGENT_PID should not be necessary, but on Win9x I had problems
running 'ssh-agent -k' when there was no agent to kill.  Maybe
keychain users need to replace

	eval `ssh-agent -k`
with
	keychain -k

(but I'm just guessing).

If *all* shells source that line, then you have the problem that the
first one to exit will kill ssh-agent, and maybe you don't want that.
You could put something a bit more sophisticated in your .bash_profile
(or whatever) to identify a "master" shell, depending on your
requirements.

Killing ssh-agent when your shell exits is not a Cygwin-specific
problem.  (Though the need to kill ssh-agent before logging off or
shutting down *is*.)

Hope this helps.

Regards,
David


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