#397 new
Will Fitzgerald

base_text_formatter should not close STDOUT

Reported by Will Fitzgerald | May 11th, 2008 @ 10:56 PM | in No-Milestone-Assigned

We see an intermittent problem when running Rspec in our continuous integration system. When base_text_formatter does a 'flush' it encounters a broken pipe.

I believe this occurs because the close method will close @output, even if @output is STDOUT. I'd like to suggest the following change to the close method, which doesn't close STDOUT (or STDERR, if that happens to be what $output is):

        def close
          if IO === @output
            @output.close unless [STDOUT, STDERR].include? @output
          end
        end

Here is the error thrown:

/p/lib/gems/rspec-1.1.2/lib/spec/runner/formatter/base_text_formatter.rb:21:in `flush': Broken pipe (Errno::EPIPE)

from /p/lib/gems/rspec-1.1.2/lib/spec/runner/formatter/base_text_formatter.rb:21:in `flush'

from /p/lib/gems/rspec-1.1.2/lib/spec/runner/formatter/progress_bar_formatter.rb:25:in `start_dump'

from /p/lib/gems/rspec-1.1.2/lib/spec/runner/reporter.rb:58:in `dump'

from /p/lib/gems/rspec-1.1.2/lib/spec/runner/reporter.rb:58:in `each'

from /p/lib/gems/rspec-1.1.2/lib/spec/runner/reporter.rb:58:in `dump'

from /p/lib/gems/rspec-1.1.2/lib/spec/runner/example_group_runner.rb:37:in `finish'

from /p/lib/gems/rspec-1.1.2/lib/spec/runner/example_group_runner.rb:26:in `run'

from /p/lib/gems/rspec-1.1.2/lib/spec/runner/options.rb:87:in `run_examples'

from /p/lib/gems/rspec-1.1.2/lib/spec/runner/command_line.rb:19:in `run'

from /p/lib/gems/rspec-1.1.2/bin/spec:4

from /p/bin/spec:19:in `load'

from /p/bin/spec:19

This is rspec 1.1.2, but I think it applies to 1.1.3 as well.

Comments and changes to this ticket

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Behaviour Driven Development for Ruby.

Shared Ticket Bins

People watching this ticket

Tags