Skip to content

Commit

Permalink
Restore OutputCapture.wrap as it's a semi-public API
Browse files Browse the repository at this point in the history
  • Loading branch information
shepmaster committed Jul 23, 2014
1 parent 57a8537 commit 666e3db
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions lib/ci/reporter/output_capture.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ module CI
module Reporter
# Captures $stdout or $stderr in order report it in the XML file.
class OutputCapture
# Creates an OutputCapture and immediately starts capturing.
def self.wrap(io, &assign)
new(io, &assign).tap {|oc| oc.start}
end

def initialize(io, &assign)
@original_io = io
@captured_io = StringIO.new
Expand Down
6 changes: 2 additions & 4 deletions lib/ci/reporter/test_suite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ def initialize(name)
def start
@start = Time.now
unless ENV['CI_CAPTURE'] == "off"
@capture_out = OutputCapture.new($stdout) {|io| $stdout = io }
@capture_err = OutputCapture.new($stderr) {|io| $stderr = io }
@capture_out.start
@capture_err.start
@capture_out = OutputCapture.wrap($stdout) {|io| $stdout = io }
@capture_err = OutputCapture.wrap($stderr) {|io| $stderr = io }
end
end

Expand Down

0 comments on commit 666e3db

Please sign in to comment.