Closing a tab or the window does not result in a logout #10891

Open
opened 2026-01-31 02:33:03 +00:00 by claunia · 0 comments
Owner

Originally created by @doomchild on GitHub (Oct 5, 2020).

I have Debian installed (uname -a returns Linux Arcadia 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64 GNU/Linux), and I was in the process of getting all of my SSH stuff setup when I noticed that my .bash_logout (where I kill the instance of ssh-agent that was started on login) wasn't getting executed if I closed a tab or exited Windows Terminal. After a couple of opens and closes, I've got five or six instances of ssh-agent -s running.

If I explicitly call logout, the window closes and I can open a new one to see that the previous instance was correctly killed as desired.

Environment

Windows build number: 10.0.19042.0
Windows Terminal version (if applicable): 1.1.2233.0

Steps to reproduce

Add the following to ~/.bashrc:

if [ -z "$SSH_AUTH_SOCK" ] ; then
  eval `ssh-agent -s`
fi

Add the following to ~/.bash_logout

if [ -n "$SSH_AUTH_SOCK" ] ; then
  eval `/usr/bin/ssh-agent -k`
fi

Close Windows Terminal.
Open Windows Terminal.
Close Windows Terminal.
Open Windows Terminal.

Execute ps aux | grep ssh-agent.

Expected behavior

There should be only one instance of ssh-agent running.

Actual behavior

There are multiple instances of ssh-agent still running.

Originally created by @doomchild on GitHub (Oct 5, 2020). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> I have Debian installed (`uname -a` returns `Linux Arcadia 4.19.104-microsoft-standard #1 SMP Wed Feb 19 06:37:35 UTC 2020 x86_64 GNU/Linux`), and I was in the process of getting all of my SSH stuff setup when I noticed that my `.bash_logout` (where I kill the instance of `ssh-agent` that was started on login) wasn't getting executed if I closed a tab or exited Windows Terminal. After a couple of opens and closes, I've got five or six instances of `ssh-agent -s` running. If I explicitly call `logout`, the window closes and I can open a new one to see that the previous instance was correctly killed as desired. # Environment ```none Windows build number: 10.0.19042.0 Windows Terminal version (if applicable): 1.1.2233.0 ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> Add the following to ~/.bashrc: ``` if [ -z "$SSH_AUTH_SOCK" ] ; then eval `ssh-agent -s` fi ``` Add the following to ~/.bash_logout ``` if [ -n "$SSH_AUTH_SOCK" ] ; then eval `/usr/bin/ssh-agent -k` fi ``` Close Windows Terminal. Open Windows Terminal. Close Windows Terminal. Open Windows Terminal. Execute `ps aux | grep ssh-agent`. # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> There should be only one instance of `ssh-agent` running. # Actual behavior <!-- What's actually happening? --> There are multiple instances of `ssh-agent` still running.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#10891