AndrewRadev / vimrunner

Control a vim instance through ruby code
MIT License
238 stars 13 forks source link

add Vimrunner::Server.pid #45

Closed jbodah closed 7 years ago

jbodah commented 7 years ago

In vim-elixir I'd like to Process.wait(vim.server.pid). Right now without waiting the MacVim instance closes immediately. My other options are to instance_eval or loop {} neither of which is very good. @AndrewRadev how would you feel about exposing the pid?

mudge commented 7 years ago

As an aside, I think your build has failed due to an external dependency change that should be fixed by #46.

Just so I can understand your use case better: are you starting up a Vim process with spawn_vim and want it to run continuously until Vim is killed from another process (rather than dying at the end of spawn_vim)?

jbodah commented 7 years ago

Just so I can understand your use case better: are you starting up a Vim process with spawn_vim and want it to run continuously until Vim is killed from another process (rather than dying at the end of spawn_vim)?

Really what I want is to just spawn vim and keep it running. It doesn't matter to me whether the bin/spawn_vim process blocks or exits as long as the spawned vim instance is running still. I suppose I could detach or shell out instead

AndrewRadev commented 7 years ago

I guess there's not much you can do without the pid, if you want to manage the process externally. An alternative might be to provide methods like wait and detach and such (we already have kill, which is the only thing that uses the pid). But it is easier to just expose the pid, so people can manipulate the process in whatever way they like.

I'm going to merge this PR, we already expose stuff like the executable, server name, and such, no harm in exposing this as well. That said, @jbodah, if you come up with some plan for how you'll use the instance, like, detach or wait or whatever, maybe we can even add some helper methods to manipulate it. Let us know.

jbodah commented 7 years ago

Thanks @AndrewRadev and @mudge