summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pandoc.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/pandoc.rb b/pandoc.rb
index a653978..9c12351 100644
--- a/pandoc.rb
+++ b/pandoc.rb
@@ -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)