diff options
-rw-r--r-- | pandoc.rb | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -18,10 +18,15 @@ module Pandoc str = str.read end json = '' + errors = '' Open3::popen3(cmd) do |stdin, stdout, stderr| stdin.puts(str) stdin.close json = stdout.read + errors = stderr.read + end + unless errors.empty? + raise errors end return Pandoc::AST::new(json) end @@ -38,12 +43,17 @@ module Pandoc def to(format) cmd = Pandoc::prog + " -f json -t " + format.to_s output = '' + errors = '' Open3::popen3(cmd) do |stdin, stdout, stderr| stdin.puts @js.to_json stdin.close output = stdout.read + errors = stderr.read + end + unless errors.empty? + raise errors end - output + return output end def self.js2sane(js) |