Skip to content

Commit

Permalink
Read stdout and stderr before halting on wait_thr value
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerDixon committed Jun 4, 2024
1 parent a849a12 commit 5fdea86
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/github/markup/command_implementation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5fdea86

Please sign in to comment.