vim-session icon indicating copy to clipboard operation
vim-session copied to clipboard

Ignore session lock if the PID does not exist anymore

Open blueyed opened this issue 9 years ago • 2 comments

With the following message/note it would be nice to have the session automatically unlocked / the lock ignored in case the PID does not exist anymore:

session.vim 2.13.1: The 'velodrome' session is locked by another Vim instance named /tmp/nvimhDKurd/0. If that doesn't seem right maybe you forcefully closed Vim or it crashed? Use the command ':SessionOpen! velodrome' to override.

The lock file looks like this:

{'pid': 10952, 'servername': '/tmp/nvimhDKurd/0'}

The servername is automatically used/generated with Neovim. The process 10952 does not exist anymore.

Relevant code: https://github.com/xolox/vim-session/blob/9e9a6088f0554f6940c19889d0b2a8f39d13f2bb/autoload/xolox/session.vim#L1143-L1149

blueyed avatar Jan 21 '16 11:01 blueyed

+1

QMonkey avatar Jan 31 '16 03:01 QMonkey

Yes that would be nice. The reason it hasn't been done (i.e. I did consider it when I was adding the session locks) is because I'm not very keen on adding yet more platform specific behavior to my Vim plug-ins:

  • Adding platform specific features looks simple / easy when you start doing it, but in my experience it's like opening a can of worms, adding support for platform after platform (and variations thereof).
    • Exposing functionality that isn't native to Vim is also kind of hairy in the sense that you have to run shell commands (i.e. not portable by definition) or use something like the Python interface (which makes the feature impossible to use for those who don't have the Python interface enabled).
    • An additional complication here is that it's impossible for me to test support for platforms that I don't have access to.
  • Also once a platform specific feature is implemented for one platform users will demand it for others platforms as well, not understanding that doing so can be a non-trivial undertaking.

Regardless of the points above, the request is reasonable so I'll leave this open as a feature request.

xolox avatar Feb 01 '16 17:02 xolox