Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore session lock if the PID does not exist anymore #143

Open
blueyed opened this issue Jan 21, 2016 · 2 comments
Open

Ignore session lock if the PID does not exist anymore #143

blueyed opened this issue Jan 21, 2016 · 2 comments

Comments

@blueyed
Copy link
Contributor

blueyed commented Jan 21, 2016

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:

let msg = "session.vim %s: The %s session is locked by another Vim instance %s."
if has_key(other_instance, 'servername')
call add(arguments, 'named ' . other_instance['servername'])
else
call add(arguments, 'with PID ' . other_instance['pid'])
endif
let msg .= " If that doesn't seem right maybe you forcefully closed Vim or it crashed?"

@QMonkey
Copy link

QMonkey commented Jan 31, 2016

+1

@xolox
Copy link
Owner

xolox commented Feb 1, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants