rxvt dialog at shutdown suggests failure to exit due to ssh-agent?

David Starks-Browning starksb@ebi.ac.uk
Thu Feb 20 12:02:00 GMT 2003


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/



More information about the Cygwin mailing list