From 5fdea867e6dde8cc60148a725f8689b0046127a8 Mon Sep 17 00:00:00 2001 From: Tyler Dixon Date: Tue, 4 Jun 2024 17:52:35 +0000 Subject: [PATCH] Read stdout and stderr before halting on wait_thr value --- lib/github/markup/command_implementation.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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