wsl-ssh-pageant icon indicating copy to clipboard operation
wsl-ssh-pageant copied to clipboard

Socket should be deleted on application exit

Open lucasvc opened this issue 5 years ago • 5 comments

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.

lucasvc avatar Feb 19 '20 07:02 lucasvc

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

h4de5 avatar Mar 10 '20 22:03 h4de5

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)

lucasvc avatar Mar 11 '20 10:03 lucasvc

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 avatar Mar 19 '20 19:03 ferenczy

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.

ferenczy avatar Mar 19 '20 20:03 ferenczy

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

intelfx avatar Oct 06 '21 04:10 intelfx