Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug STDOUT isn't captured #65

Merged

Conversation

pocke
Copy link
Contributor

@pocke pocke commented Sep 1, 2016

Problem

In my environment, rrrspec doesn't capture stdout in second and subsequent.

example

Focus on one slave.

First time
screen shot 2016-09-01 at 19 29 23

Second time

screen shot 2016-09-01 at 19 29 41

STDOUT is empty.

version

  • RRRSpec 0.4.3

@sorah
Copy link
Member

sorah commented Sep 1, 2016

LGTM.

@sorah
Copy link
Member

sorah commented Sep 1, 2016

cc @cookpad/rrrspec

@pocke if possible please explain background and your analysis at here, too.

@pocke
Copy link
Contributor Author

pocke commented Sep 2, 2016

Analysis

First, I've debugged the problem by debug printing.

# In spec_helper
RSpec.configure |config|
  config.before do
    $stdout.puts "======================== StdOut Before Each ========================"
  end

  config.after do
    $stdout.puts "======================== StdOut After Each ========================"
  end
end

I added the above code, and run RRRSpec. Then RRRSpec captures StdOut Before Each and StdOut After Each but rspec's output is not captured.

screen shot 2016-09-02 at 10 52 20

So, I guess problem is in output_stream.

Second, I try outputting object_id of $stdout and RSpec.configuration.output_stream.
Then I've confirmed they are same object.

screen shot 2016-09-02 at 10 53 43

Cause (guess)

I guess this cause is difference between add_formatter and default_formatter.

In add_formatter, a formatter is received an output_stream. However, in default_formatter, a formatter is not received an output_stream.
It's a problem of output_stream, so, I guess the cause is the difference.

@eagletmt eagletmt merged commit 308c74e into cookpad:master Sep 2, 2016
@pocke pocke deleted the fix-not-capture-stdout-at-second-time branch September 2, 2016 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants