benpye / wsl-ssh-pageant

A Pageant -> TCP bridge for use with WSL, allowing for Pageant to be used as an ssh-ageant within the WSL environment.
BSD 2-Clause "Simplified" License
612 stars 40 forks source link

Socket should be deleted on application exit #34

Open lucasvc opened 4 years ago

lucasvc commented 4 years ago

I have a shortcut on my shell:startup to open Pageant with my key and after start wsl-ssh-pageant using WSL socket:

"C:\Program Files\PuTTY\pageant.exe" "C:\Users\lucsavc\lucsavc.ppk" -c "C:\Users\lucsavc\software\wsl-ssh-pageant\wsl-ssh-pageant-amd64-gui.exe" --systray --wsl "%TMPDIR%\wsl-ssh-pageant.sock"

When shuting down the computer normally, seems that systray application is not stopped and the socket file is left there. So next start, application won't start as socket is already there.

h4de5 commented 4 years ago

try --force option. an existing socket will be overwriten.

lucasvc commented 4 years ago

Thanks, works like a charm. Btw, that flag is not in the README :) (I will leave open if you want to add it or so)

ferenczy commented 4 years ago

I just also noticed this issue. A combination of this issue and #35 is that it's permanently not working and the user is not exactly sure why.

It would be good to have the option --force in the documentation and also to produce an error message (both on the console and as a GUI dialog) in case --force is not used and a socket file already exists.

ferenczy commented 4 years ago

BTW the --force option shouldn't be needed during a regular usage of the application. It's good to have it in case the application or the operating system have crashed before, so I don't have to manually delete the socket file, but an issue to fix in the first place is that the socket file is not being deleted during a successful shutdown, I would say.

intelfx commented 2 years ago

but an issue to fix in the first place is that the socket file is not being deleted during a successful shutdown, I would say

Honestly, not really.

As you correctly note, the OS and/or the computer might crash at any moment, leaving no chance for cleanup actions to run. Any background service is expected to deal with such issues automatically. The user should not be required to check up on his/her services and babysit them after each unclean shutdown.

This means that --force should be default and the only behavior (with an added check to prevent multiple living instances fighting over the same socket).