Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
No zombies #4
Hi, I switched to your preview plugin from another markdown preview plugin, and I'm having a great time.
Attached is a patch that reaps zombies created by Kernel#fork and uses more standard approaches for shell escaping. The details are in the patch header.
Btw, if you do alot of shelling out from ruby, I suggest you take a look at the shellwords module and the new 1.9 features for system, exec, and spawn. Most of the time though, you can just feed shell params to system and friends as separate params (and not a single string) and be fine.
Hi, Sung! Let me thank you for your effort!
You can do a simple test in your Vim editor(type this, save a file and do
In this case you'll never see
Please let me know, if I'm wrong or if your changes really work for you.
Ah, it seems there's a bit I don't understand about Vim's ruby integration. You're right, zombies were still being created. This would not be happening if vim didn't kill the thread running the ruby interpreter, or if it ran ruby commands in a subprocess (where we could just tell it to wait for children to die with
(I accidentally pushed a commit; please ignore)
Okay, one solution: just do what Process#detach would have done by hand. Double fork so that the browser process is no longer a child of vim, and let the first child set up the reaping thread.
Since the first child just forks and detaches the browser process, it will return very quickly and we can feel free to block and reap it via Process#wait.
Tell me what you think!