xwmx / pandoc-ruby

Ruby wrapper for Pandoc
MIT License
340 stars 43 forks source link

Add timeout option for out-of-control pandoc jobs #16

Closed dginev closed 8 years ago

dginev commented 8 years ago

During our production use of the PandocRuby wrapper at Authorea (www.authorea.com) we have been hitting the occasional out-of-control pandoc job.

While we are pretty sure the pandoc team will eventually resolve each individual problem, the general possibility for an unforeseen problem is always there (look at the extremely weird bomb.tex in this PR for one current example).

So in this PR I am proposing a Ruby-level timeout option, which does a dirty -9 kill to the pandoc process if it has not terminated in the allotted time. It is a pretty standard technique for wrappers, though I wish pandoc supported a --timeout switch natively.

Let me know what you think about this PR, I would be happy to refactor it to your liking.

And thanks for the handy wrapper!

xwmx commented 8 years ago

Makes sense. I'll take a look!

dginev commented 8 years ago

Did you have any time to take a look into this? Shouldn't be too much work!

xwmx commented 8 years ago

Sorry for the delay, and thanks for implementing this enhancement. It's now merged and will be included in version 2+ of the gem. Also, Authorea looks very interesting!