Add command output on failed commands

Change-Id: I3b7e98cca90bc2ee96ba5eb4bb1c69050e70ed3c
Reviewed-on: https://gerrit.instructure.com/102634
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Product-Review: Ryan Shaw <ryan@instructure.com>
QA-Review: Brad Horrocks <bhorrocks@instructure.com>
This commit is contained in:
Brad Horrocks 2017-02-17 15:19:54 -07:00
parent 34af3f00fe
commit 208c996566
1 changed files with 6 additions and 2 deletions

View File

@ -263,9 +263,10 @@ module BrandableCSS
percent_complete = 0
Open3.popen2e(command) do |_stdin, stdout_and_stderr, wait_thr|
error_output = []
stdout_and_stderr.each do |line|
Rails.logger.try(:debug, line.chomp!) if defined?(Rails)
error_output.push(line)
# This is a good-enough-for-now approximation to show the progress
# bar in the UI. Since we don't know exactly how many files there are,
# it will progress towards 100% but never quite hit it until it is complete.
@ -276,7 +277,10 @@ module BrandableCSS
opts[:on_progress].call(percent_complete)
end
end
raise("Error #{msg}") unless wait_thr.value.success?
unless wait_thr.value.success?
STDERR.puts error_output.join("\n")
raise("Error #{msg}")
end
end
end
end