diff --git a/lib/github/markup/command_implementation.rb b/lib/github/markup/command_implementation.rb index 4ecf2ad5..b58d3261 100644 --- a/lib/github/markup/command_implementation.rb +++ b/lib/github/markup/command_implementation.rb @@ -53,11 +53,13 @@ def execute(command, target) output = Open3.popen3(*command) do |stdin, stdout, stderr, wait_thr| stdin.puts target stdin.close - if wait_thr.value.success? - stdout.readlines - else - raise CommandError.new(stderr.readlines.join('').strip) - end + + stdout_lines = stdout.readlines + stderr_lines = stderr.readlines.join('').strip + + raise CommandError.new(stderr_lines) unless wait_thr.value.success? + + stdout_lines end sanitize(output.join(''), target.encoding) end