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

Cucumber::Formatter::Interceptor::Pipe is not treated as an IO by ruby's built-in Logger #312

Closed
rsutphin opened this issue Sep 7, 2012 · 4 comments
Assignees
Milestone

Comments

@rsutphin
Copy link

rsutphin commented Sep 7, 2012

If you run Cucumber with the JUnit formatter enabled on an application which has code like the following:

Logger.new($stderr)

You will get an exception like this:

can't convert Cucumber::Formatter::Interceptor::Pipe into String
/Users/rsutphin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/logger.rb:592:in `open'
/Users/rsutphin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/logger.rb:592:in `open_logfile'
/Users/rsutphin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/logger.rb:549:in `initialize'
/Users/rsutphin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/logger.rb:314:in `new'
/Users/rsutphin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/logger.rb:314:in `initialize'

Ruby's built in logger uses this check to determine if a passed in object is an IO:

if log.respond_to?(:write) and log.respond_to?(:close)

Pipe has a write method, so adding a no-op Cucumber::Formatter::Interceptor::Pipe#close method might work around this problem.

@mattwynne
Copy link
Member

On 7 Sep 2012, at 22:58, Rhett Sutphin wrote:

If you run Cucumber with the JUnit formatter enabled on an application which has code like the following:

Logger.new($stderr)
You will get an exception like this:

can't convert Cucumber::Formatter::Interceptor::Pipe into String
/Users/rsutphin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/logger.rb:592:in open' /Users/rsutphin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/logger.rb:592:inopen_logfile'
/Users/rsutphin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/logger.rb:549:in initialize' /Users/rsutphin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/logger.rb:314:innew'
/Users/rsutphin/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/logger.rb:314:in `initialize'
Ruby's built in logger uses this check to determine if a passed in object is an IO:

if log.respond_to?(:write) and log.respond_to?(:close)
Pipe has a write method, so adding a no-op Cucumber::Formatter::Interceptor::Pipe#close method might work around this problem.


Reply to this email directly or view it on GitHub.

Thanks for figuring this out. Do you think you put together a pull request with a failing integration test for this? It's much more likely to get fixed that way.

@mattwynne
Copy link
Member

Actually I think the Interceptor::Pipe should be delegating respond_to properly, that's the real problem.

@mattwynne
Copy link
Member

Are we going to get a PR for this? 😄

@ghost ghost assigned os97673 Apr 16, 2013
@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants